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

script works in roblox studio testing but not in server testing?

Asked by 3 years ago

(in a local script)

local plr = game.Players.LocalPlayer

plr.Character:WaitForChild("Humanoid").Died:Connect(function()
    game.ReplicatedStorage.playerDeadEvent:FireServer(plr)
end)


(in a server script in serverscriptservice)


game.ReplicatedStorage.playerDeadEvent.OnServerEvent:Connect(function(i, plr) local character = plr.Character plr.character:WaitForChild("Humanoid").Died:Connect(function() wait(7) if plr.TeamColor == BrickColor.new("Really red") then plr.Character:MoveTo(game.Workspace.map.redtelePart.Position) local sword = game.ReplicatedStorage.ClassicSword:Clone() sword.Parent = plr.Backpack end if plr.TeamColor == BrickColor.new("Electric blue") then plr.Character:MoveTo(game.Workspace.map.bluetelePart.Position) local sword = game.ReplicatedStorage.ClassicSword:Clone() sword.Parent = plr.Backpack end end) end)

works in studio when you reset and it teleports you back to the arena, but when another client kills you in server testing it just teleports you to the lobby (where the spawn points are) and this script doesn't teleport you back

0
Why do you fireserver on death and then have the server wait for the death again, if it had already happened? Amiaa16 3227 — 3y
0
Try running the Humanoid.Died function on the server instead of the client. THEROBLOXAIN2 15 — 3y

Answer this question