Why is my wait function is not working properly?
I tried to fire a remote event after 5 seconds but it didn't seem to work. I tried using print to debug it and still
these are all my script involving this problem
3 | local button = script.Parent |
4 | local remote = game.ReplicatedStorage:WaitForChild( "Reemote" ) |
6 | button.MouseButton 1 Click:Connect( function () |
-
3 | local button = script.Parent |
4 | local weaponRemote = game.ReplicatedStorage:WaitForChild( "WeaponEvent" ) |
6 | button.MouseButton 1 Click:Connect( function () |
8 | weaponRemote:FireServer() |
-
02 | local famas = game.ReplicatedStorage.FAMAS |
03 | local scarL = game.ReplicatedStorage [ "SCAR-L" ] |
04 | local famasClone = famas:Clone() |
05 | local scarLClone = scarL:Clone() |
06 | local remote = Instance.new( "RemoteEvent" ) |
07 | remote.Parent = game.ReplicatedStorage |
08 | remote.Name = "WeaponEvent" |
10 | remote.OnServerEvent:Connect( function (plr) |
11 | famasClone.Parent = plr.Backpack |
12 | scarLClone.Parent = plr.Backpack |
13 | print ( "weaponscript activated" ) |
-
02 | math.randomseed(tick()) |
03 | local remote = Instance.new( "RemoteEvent" ) |
04 | remote.Parent = game.ReplicatedStorage |
05 | remote.Name = "Reemote" |
06 | local spawns = workspace.Spawns:GetChildren() |
08 | remote.OnServerEvent:Connect( function (plr) |
10 | local PlayerSpawn = spawns [ math.random( 1 ,#spawns) ] |
11 | plr.Character:SetPrimaryPartCFrame(CFrame.new(PlayerSpawn.Position.X,PlayerSpawn.Position.Y + 5 ,PlayerSpawn.Position.Z)) |
12 | print ( "spawn script activated" ) |
the output will be like this
weaponscript activated
spawn script activated
where the weapon script got activated first