Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why my instance.new keeps going on forever when i clicked it?

Asked by 3 years ago

I am making a test game and to test and spawn boss u need to click the button on the gui. However, i am having a trouble with the button "Delete all boss" i scripted it that it deletes the original folder and creates a new one Here is the script:

local ReplicatedStorage = game:GetService("ReplicatedStorage") 
local remoteEvent = ReplicatedStorage:WaitForChild("DeletezaBossu")
local ServerStorage = game:GetService("ServerStorage")
local Workspace = game:GetService("Workspace")
local Boss = game.Workspace.Boss


function onServerEvent(player)
    Boss:Destroy()
    wait(1)
    local Boss = Instance.new("Folder")
    Boss.Name = "Boss"
    Boss.Parent = Workspace

    end

remoteEvent.OnServerEvent:Connect(onServerEvent)

any help appreciated!

0
Can you send the local script that fires the remote event? LeedleLeeRocket 1257 — 3y
0
How do i send it to u? skeletonpiratejack 13 — 3y

1 answer

Log in to vote
0
Answered by 3 years ago

You forgot an end after this:

remoteEvent.OnServerEvent:Connect(onServerEvent)

You should do this:

remoteEvent.OnServerEvent:Connect(onServerEvent)
end

I'm pretty new to scripting tho so it may be wrong

0
nvm got it skeletonpiratejack 13 — 3y
Ad

Answer this question