Hi i want to anchor a character but when i do the server stop replicate the cframe because the character is now anchored, if there any solution to this problem
I tried to to with all the body modifiers and don’t give me the result that i want
here is the code:
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local root = char:WaitForChild('HumanoidRootPart')
local hum = char.Humanoid
hum.WalkSpeed = 0
hum.JumpPower = 0
local mouse = plr:GetMouse()
game:GetService('RunService').RenderStepped:Connect(function()
root.CFrame = CFrame.new(root.CFrame.p,root.CFrame.p + Vector3.new(mouse.hit.lookVector.x,mouse.hit.lookVector.y,mouse.hit.lookVector.z))
end)
Not sure if this would be reliable, but couldn’t you replicate the CFrame by using RemoteEvents?
local plr = game.Players.LocalPlayer
local char = plr.Character or plr.CharacterAdded:wait()
local root = char:WaitForChild('HumanoidRootPart')
local hum = char.Humanoid
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
hum.WalkSpeed = 0
hum.JumpPower = 0
local mouse = plr:GetMouse()
game:GetService('RunService').RenderStepped:Connect(function()
local CFrameResult = CFrame.new(root.CFrame.p,root.CFrame.p + Vector3.new(mouse.hit.lookVector.x,mouse.hit.lookVector.y,mouse.hit.lookVector.z))
Event:FireServer(CFrameResult)
end)
--Server Script in the random ServerScriptService
local Event = game.ReplicatedStorage:WaitForChild("RemoteEvent")
Event.OnServerEvent:Connect(function(Player, CFrameResult)
Player.Character.HumanoidRootPart.CFrame = CFRameResult
end)
Anytime! Yeah since you’re doing that client sided, the changes won’t be replicated to the server so you’d need to use RemoteEvents in this Instance which is basically 1 way transportation (Or Client-Server)
Do look at the API Reference for this so you have a better understanding: