Im Gonna be as Specific as Possible Im making a Script where if u touch this Part it makes Everything Unanchored but I want the player to have a Specific amount of Walkspeed I been trying to do this for 2 Hours and nothin is working and I tried this with Server Script Service to
and I have the script inside the part so rn this is what i have rn to test it before using the rest of the script
this is my current script after deleting the others that didnt work
local BrokenGlass = script.Parent.BrokenGlasses
local MainGlass = script.Parent.MainGlass
MainGlass.Touched:Connect(function(Player)
local PlayerHumanoid = Player:FindFirstChild(“Humanoid”)
if PlayerHumanoid.WalkSpeed ~= nil and PlayerHumanoid.WalkSpeed == 60 then
You shouldn’t use WaitForChild here since if the player is going to be sending Touched events, they’re probably alive and well. Dot index (hit.Parent.Humanoid) should be used instead.
MainGlass.Touched:Connect(function(Hit)
local health = hit.Parent:WaitForChild("Humanoid").Walkspeed
print(Hit.Parent, health)
or
MainGlass.Touched:Connect(function(Hit)
local health = hit.Parent:WaitForChild("Humanoid").Walkspeed
if health >= 16 then
--whatever you want to do
end