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

ContextActionService Freezes all Player controls in the server?

Asked by 4 years ago

Hello.

I am currently making a block where if it is hit, it freezes the charater controls and makes the player move. This does work however it disables controls for every other player in the server. I have been attempting to fix this for hours but I had absolutely 0 luck.

Here is the script I am using:

01--###----------[[SERVICES]]----------###--
02local ContextActionService = game:GetService("ContextActionService")
03 
04local Players = game:GetService("Players")
05 
06 
07 
08--###----------[[VARIABLES]]----------###--
09local AutoWalk = workspace.Map.Rooms.Downstairs["Room 1"].AutoWalk_Stairs
10 
11local FreezeCharacter = "DisengageControls"
12local Debounce = false
13 
14local DestinationPoint = Vector3.new(-20.209, 3.29, -480.929)
15 
View all 49 lines...

If anybody could help me with this, it would be great.

Thanks

0
Why not just set their walkspeed to 0? iOwn_You 543 — 4y
0
Or anchor their HumanoidRootPart iOwn_You 543 — 4y
0
Because if I set their walkspeed to 0 the whole Humanoid:MoveTo(DestinationPoint) would also stop RazzyPlayz 497 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

Complete edit:

The problem here is that .Touched fires to everyone when every part touches it. So instead, use Players:GetPlayerFromCharater() and make sure the player is the local player. On every touch the function runs to every player.

0
This is all done on a LocalScript because the function ContextActionService:BindAction can only be called by local scripts RazzyPlayz 497 — 4y
0
I edited my post. I understand what's wrong. LightningLIon58 49 — 4y
Ad

Answer this question