Xekvern
(Xekvern)
#1
I’m having an issue with my code. It couldn’t unanchor the player’s HumanoidRootPart but I don’t see any errors at all. Or am I just being dumb?
Here is my code in a Local Script that checks if the text button is clicked:
local setCharacterMovement = game.Players.LocalPlayer.Character:WaitForChild('HumanoidRootPart').Anchored
script.Parent.MouseButton1Click:Connect(function(player)
setCharacterMovement = false
end)
I’ve Anchored the player’s HumanoidRootPart on a Script
Forummer
(Forummer)
#2
Unanchor the HumanoidRootPart on the server.
You can achieve this with a RemoteEvent.
1 Like
Use this code here:
local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild('HumanoidRootPart')
script.Parent.MouseButton1Click:Connect(function(player)
HumanoidRootPart.Anchored = false
end)
2 Likes
Xekvern
(Xekvern)
#4
Both of your solutions worked. Thanks for the help!
Heres my first try and it worked:
LocalScript Button RemoteEvent Solution:
local AnchorEvent = re.PlayerEvents.AnchorEvent
script.Parent.MouseButton1Click:Connect(function(player)
AnchorEvent:FireServer()
end)
Second Solution PoppyandNeivaaracute’s code:
local HumanoidRootPart = game.Players.LocalPlayer.Character:WaitForChild('HumanoidRootPart')
script.Parent.MouseButton1Click:Connect(function(player)
HumanoidRootPart.Anchored = false
end)
Thanks to both of you.