Lyher99

help me create script spawn /setspawn (admnin) /spawn (player teleport to spawn)

Kodari AI
KodariMar 18 at 3:26 pm 1,460 (v2)

I’ll create a simple spawn system with admin and player commands.

SpawnSystem
A lightweight spawn management system for Minecraft servers. Allows administrators to set a spawn point using /setspawn, and players can teleport to that location using /spawn. The spawn location persists across server restarts and includes configurable cooldowns and teleportation delays for balanced gameplay.

Created a complete spawn system! Here’s what it includes:

Features:

  • /setspawn - Sets spawn to your location (requires spawn.admin permission)

  • /spawn - Teleports players to spawn with 3-second delay and 5-second cooldown

  • Movement detection cancels teleport if player moves

  • Spawn location persists across restarts

Installation:

  1. Place spawn.sk in plugins/Skript/scripts/

  2. Run /sk reload spawn or restart server

  3. Use /setspawn to set your spawn point

  4. Players can use /spawn to teleport

Permissions:

  • spawn.admin - Required for /setspawn command

  • /spawn has no permission requirement (all players can use it)

Customization: Edit the options at the top to change:

  • prefix - Message prefix

  • cooldown - Seconds between /spawn uses (default: 5)

  • delay - Teleport delay in seconds (default: 3)

Kodari can make mistakes. Review important code before using.
Files
spawn.sk
Code
1 45
spawn.sk
options:
    prefix: &6[Spawn]&r
    cooldown: 5
    delay: 3

on script load:
    send "{@prefix} &aSpawn system loaded!" to console

command /setspawn:
    permission: spawn.admin
    permission message: &cYou don't have permission to use this command!
    trigger:
        set {spawn.location} to location of player
        set {spawn.world} to world of player
        send "{@prefix} &aSpawn location set to your current position!"
        send "{@prefix} &7World: &e%world of player%"
        send "{@prefix} &7X: &e%x-coordinate of player% &7Y: &e%y-coordinate of player% &7Z: &e%z-coordinate of player%"

command /spawn:
    trigger:
        if {spawn.location} is not set:
            send "{@prefix} &cSpawn location has not been set yet!"
            stop
        
        if {spawn.cooldown::%player%} is set:
            send "{@prefix} &cPlease wait before using this command again!"
            stop
        
        send "{@prefix} &eTeleporting to spawn in {@delay} seconds..."
        send "{@prefix} &cDon't move!"
        
        set {_originalLocation} to location of player
        
        wait {@delay} seconds
        
        if distance between {_originalLocation} and location of player is greater than 0.5:
            send "{@prefix} &cTeleportation cancelled! You moved!"
            stop
        
        teleport player to {spawn.location}
        send "{@prefix} &aYou have been teleported to spawn!"
        
        set {spawn.cooldown::%player%} to true
        wait {@cooldown} seconds
        delete {spawn.cooldown::%player%}