local Freeze = game.ReplicatedStorage:FindFirstChild("FreezePlayer")
local LineModel = script.Parent
local Spots = LineModel.Spots:GetChildren()
local Cooldown = false
local function spotCheck()
for SpotNumber = 1, #Spots, 1 do
if not Spots[SpotNumber]:FindFirstChildOfClass("StringValue") then
return Spots[SpotNumber]
end
end
end
LineModel.EnterPart.Touched:Connect(function(HitPart)
if HitPart and HitPart.Parent:FindFirstChild("Humanoid") then
if Cooldown == false then
Cooldown = true
local Character = HitPart.Parent
local Player = game.Players:GetPlayerFromCharacter(Character)
local Spot = spotCheck()
spawn(function()
wait(1)
Cooldown = false
end)
Freeze:FireClient(Player, true)
Character:SetPrimaryPartCFrame(LineModel.TPPart.CFrame)
Character.Humanoid:MoveTo(Spot.Position)
Character.Humanoid.MoveToFinished:wait()
end
end
end)
Freeze script:
local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"
game.ReplicatedStorage.FreezePlayer.OnClientEvent:Connect(function(State)
if State == true then
ContextActionService:BindAction(
FREEZE_ACTION,
function()
return Enum.ContextActionResult.Sink -- need to explicitly return this
end,
false,
unpack(Enum.PlayerActions:GetEnumItems())
)
elseif State == false then
ContextActionService:UnbindAction(FREEZE_ACTION)
end
end)
The problem you’re experiencing here is that the client is the network owner of their character controller, not the server.
So the server is telling the Humanoid to move, but the Humanoid is actually being controlled by the Character.
To solve this, remove the :MoveTo call from the server, and move to to the client - something like this:
-- LocalScript (obviously)
local Players = game:GetService("Players")
local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"
local Player = Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Humanoid = Character:WaitForChild("Humanoid")
game.ReplicatedStorage.FreezePlayer.OnClientEvent:Connect(function(State, TargetGoal)
if State == true then
ContextActionService:BindAction(
FREEZE_ACTION,
function()
return Enum.ContextActionResult.Sink -- need to explicitly return this
end,
false,
unpack(Enum.PlayerActions:GetEnumItems())
)
Humanoid:MoveTo(TargetGoal)
Humanoid.MoveToFinished:Wait() -- I assume you want to unfreeze when they get there
ContextActionService:UnbindAction(FREEZE_ACTION)
elseif State == false then
ContextActionService:UnbindAction(FREEZE_ACTION)
end
end)
Your character is controlled by the client entirely - even whilst the properties may not replicate their effects are the same. It would be stranger behavior for the Humanoid::MoveTo method call to work than not.