Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Lag spike everytime somebody respawns ?

Having this issue with R15, just wondering if anybody else is experiencing this ?

Happens everytime a characters loads after they die.

The only scripts I have when a character respawns is a collision script

and

A script that loops through the player and locks every part

local Players = game:GetService("Players")
 
Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(char)
		for k,v in pairs(Players[player.Name].Character:GetChildren()) do
        wait()
        if v:IsA"BasePart" then
            v.Locked = true
        end
    end
	end)
end)

3 comments

0

what is the point of locking everything

0

because its a soccer game and the players get kicked around if they aren't locked

0

they also get picked up if u try to catch them

1 answer

Uhh nothing is really wrong in your script.

v:IsA("BasePart")

        if v:IsA("BasePart") then
            v.Locked = true
        end

You already have char so you could do it like

--Line 4
player.CharacterAdded:Connect(function(char)
	for k,v in pairs(char:GetChildren()) do

This discussion is preserved as it was. New answers, comments, and votes are closed.