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

Infinite yeild possible on player.playerscripts?

Asked by 6 years ago
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?

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? SkeletalReality 590 — 6y
0
yes i know that, thats why i have this line of code: if Hit.Parent:FindFirstChild("Humanoid") then User#17125 0 — 6y

1 answer

Log in to vote
0
Answered by
cabbler 1942 Moderation Voter
6 years ago

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

Ad

Answer this question