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

Infinite yeild possible on player.playerscripts?

wait(5)
local player = game.Players.LocalPlayer
player.Character.Humanoid.WalkSpeed = 18


local keep = game.ReplicatedStorage.Electricity:Clone()
 keep.Parent = player.Character.Humanoid.Torso

player.Character.Humanoid.Touched:Connect(function(Hit)
    if Hit.Parent:FindFirstChild("Humanoid") then
    local Name = game.Players:GetPlayerFromCharacter(Hit.Parent)
    if Name.Name ~= player.Name then
	local Backup =Name:WaitForChild("PlayerScripts").ControlScript:Clone()
	Name.PlayerScripts.ControlScript:Destroy()
	print("NICE")
	wait(2)
	Backup.Parent =Name.PlayerScripts
	wait(5)
end
    end

end)

So, on the "if Hit.Parent:FindFirstChild("Humanoid") then" I am getting an infinite yeild. Previously, i didn't even add find first child and it said playerscripts is not apart of player.

But obviously, playerscripts is apart of the player. What is wrong here?

Also, can i affect another player with a local scrip, such as disabling them, as done here?

2 comments

0

I hope you are aware that in the function where the Humanoid is being touched, the "hit" variable refers to what touched the character. For example, if you're walking on a baseplate, it will activate the function and "hit" will refer to the baseplate touching the character. Is this a script for when two humanoid come in contact?

0

yes i know that, thats why i have this line of code: if Hit.Parent:FindFirstChild("Humanoid") then

1 answer

Clients can't access anyone's PlayerScripts, nor can the server. With filtering enabled none of this would work anyway.

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