A continuación aparece una instantánea de la página web tal y como aparecía en 19/5/2024 (la última vez que nuestro rastreador la visitó). Esta es la versión de la página que se usó para la clasificación de los resultados de búsqueda. Puede que la página haya cambiado desde la última vez que la guardamos en caché. Para ver lo que puede haber cambiado (sin la información destacada), ve a la página actual.
Bing no se hace responsable del contenido de esta página.
My script causes a lot of errors and lag on the ServerSide. Any tips? - Scripting Support - Developer Forum | Roblox
Developer Forum | Roblox
I’ve been working on a game for some time now, and I’ve tried to implement a mechanism to prevent spawn killing. Any tips on how to improve it? It constantly give the error
Workspace.eTops.current.sandtops.Team Spawns.barrier.Script:3: attempt to index nil with "TeamColor"
script.Parent.Touched:Connect(function(otherPart)
local plr = game:GetService("Players"):GetPlayerFromCharacter(otherPart.Parent)
if plr.TeamColor == game:GetService("Teams"):FindFirstChild("Blue Team").TeamColor then
plr:LoadCharacter()
game.ReplicatedStorage.eTops.ServerClient.ACNotify:FireClient(plr, 2)
end
end)
This is my current script. ACNotify is a Remote Event and just sends a client notification if the player gets respawned
otherPart might not be the player, as Touched runs every time something touches the part (doesnt have to be the player)
script.Parent.Touched:Connect(function(otherPart)
local plr = game:GetService("Players"):GetPlayerFromCharacter(otherPart.Parent)
if not plr then return end
if plr.Team == game:GetService("Teams")["Blue Team"] then
plr:LoadCharacter()
game.ReplicatedStorage.eTops.ServerClient.ACNotify:FireClient(plr, 2)
end
end)
local debounces = {}
script.Parent.Touched:Connect(function(otherPart)
local plr = game:GetService("Players"):GetPlayerFromCharacter(otherPart.Parent)
if not plr then return end
if debounces[plr.UserId] then return end
if plr.Team == game:GetService("Teams")["Blue Team"] then
debounces[plr.UserId] = true
plr:LoadCharacter()
game.ReplicatedStorage.eTops.ServerClient.ACNotify:FireClient(plr, 2)
task.delay(2, function() debounces[plr.UserId] = nil end)
end
end)