No error, code doesn’t work. Back to point zero could this be cuz it’s a child to the part?
Is this in a server script or local script?
Local.
Ahh okay I see. What I recommend is putting this in a server script, but use a remote event to disable the character controls in a local script.
Alright. Can you help me out with changing the script and creating a remote event?
I’m a newbie in scripting and have no idea how to use remote events…
Put this in a server script inside StarterPlayerScripts:
local Players = game:GetService("Players")
local GoTo = game.Workspace:FindFirstChild("destination")
local tp3 = script.Parent
local DisableControls = script.RemoteEvent
tp3.Touched:Connect(function(hit)
local w = hit.Parent:FindFirstChild("HumanoidRootPart")
for _,player in pairs(game.Players:GetPlayers()) do
local char = player.Character
local humanoid = char:FindFirstChild("Humanoid")
DisableControls:FireClient()
humanoid:MoveTo(GoTo.Position)
v.Humanoid.Jump = true
wait(.5)
v.Humanoid.Jump = true
wait(5)
end
end)
And add a remote event inside of it, and inside the remote event should be the local script. The local script should have this:
script.Parent.OnClientEvent(function()
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()---GetControls
Controls:Disable()
end)
The reason why your script wasn’t working earlier is because LocalScripts only work in StarterCharacterScripts, StarterPlayerScripts, and PlayerGui. (I believe there are more instances you can put a LocalScript in but I don’t remember much)
Can I see how you have your scripts laid out?
RemoteEvent 2 is to reenable controls
Forcewalk should be a server script.
Where do I put serverscript? Child it to tp 3 ? Doesn’t work in that case.
No, just make a server script and put the code that I mentioned in there, put inside starter pack, and put remote event 1 and 2 inside of the server script.
Whoops I made a mistake in my local scripts. Should be this instead
script.Parent.OnClientEvent:Connect(function()
local Controls = require(game.Players.LocalPlayer.PlayerScripts:WaitForChild("PlayerModule")):GetControls()---GetControls
Controls:Disable()
end)
I apologize for all the mistakes as it’s been forever since I’ve actually coded in Roblox studio lol.
You’re running .Touched on the player backpack.
Run it on the part you wish to activate the force walk.
How am i running it if the line is tp3.Touched:Connect(function(hit)
?
Because the tp3 variable is set to script.Parent. Set it to the part.
No errors. Doesn’t work …
Try adding prints in the script that indicate when the part is touched, when the player is being forced to walk, etc and tell me what the output is