I’ve looked everywhere but I can’t find an answer!
When I spawn and I use the move, it’s fine.
When I move to a different direction, it doesn’t rotate. How can I fix this?
Any help is appreciated.
I’ve looked everywhere but I can’t find an answer!
When I spawn and I use the move, it’s fine.
When I move to a different direction, it doesn’t rotate. How can I fix this?
Any help is appreciated.
Add a primaryPart CFrame for your model and try this code. Change YourModel and plrChar to your path to them
local modelCFrame = YourModel:GetPrimaryPartCFrame()
local PlayerCharCFrame = plrChar:GetPrimaryPartCFrame()
YourModel:SetPrimaryPartCFrame(modelCFrame * (PlayerCharCFrame - plrChar.PrimaryPart.Position))
EDIT: Means you need to detect when player moved so add an check
the water wheel won’t teleport to the characters position, i dont know why
local modelCFrame = waterwheel:GetPrimaryPartCFrame()
local PlayerCharCFrame = char:GetPrimaryPartCFrame()
waterwheel:SetPrimaryPartCFrame(modelCFrame * (PlayerCharCFrame - char.PrimaryPart.Position))
when i spawn in char.PrimaryPart is the Head
Char.PrimaryPart should be HumanoidRootPart, did you changed it? Anyways as i already mentioned you need to add check for that. You can try something like that:
local LastCFrame = char.CFrame
game:GetService("RunService").RenderStepped:Connect(function()
if (char.CFrame ~= LastCFrame) then
LastCFrame = char.CFrame
local modelCFrame = waterwheel:GetPrimaryPartCFrame()
local PlayerCharCFrame = char:GetPrimaryPartCFrame()
waterwheel:SetPrimaryPartCFrame(modelCFrame * (PlayerCharCFrame -
char.PrimaryPart.Position))
end
end)
“RenderStepped event can only be used from local scripts”
I’m dumb. I welded the PrimaryPart to the HumanoidRootPart with a WeldConstraint. I switched to a Weld and it works like a charm.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.