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

Why isn't this .Disabled function not working, Why isn't the script not restarting?

Asked by 4 years ago

Gameplay is the script inside the textlabel, the script is a zombie spawner Why isn't the script not restarting This script is a local script, in a gui:

player.PlayerGui.Wave.TextLabel.GamePlay.Disabled = true
game.StarterGui.Wave.TextLabel.GamePlay.Disabled = true
wait(5)
player.PlayerGui.Wave.TextLabel.GamePlay.Disabled = false
game.StarterGui.Wave.TextLabel.GamePlay.Disabled = false

1 answer

Log in to vote
1
Answered by 4 years ago

I think I have a solution. I'm not sure if the Disabled method would work how you might want, another way to do this is to put a RemoteEvent ReplicatedStorage, and you'll Fire this to tell the script to spawn or not. Also a quick side note, if the zombie spawner is a server script, It should be in ServerScriptService, since im not sure if the scripts work there, and that might also be a problem. (Correct me if I'm wrong)

Here's what I mean:

Local script, In a gui

local Spawner = game.ReplicatedStorage.Spawn --Put a RemoteEvent ReplicatedStorage
local Time = 5 --This is how long the zombies will spawn
--Any other code you want
Spawner:FireServer(Time) 

Server Script (Script), In ServerScriptService

local Spawner = game.ReplicatedStorage.Spawn

Spawner:OnServerEvent(Player, Time)
local Waiting = 0
repeat wait(--The speed of the zombie spawning. You can change this around to get different spawn times and speeds)
Waiting = Waiting + 1
--Spawn a zombie and stuff
until Waiting >= Time
end)

Going forward, If your creating any parts, using RemoteEvents really helps with communication between client and server. I hope this helps!

Ad

Answer this question