Hi, I would like to rotate a Model(That exists only on the client) using a ModuleScript.
I tried to rotate it the normal way, but it just doesn’t rotate(no errors on the console):
UIS.InputBegan:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.Keyboard then
local value = inputObject.KeyCode.Value
if value == 114 then
if script.Parent.Configuration.UnitEditor.Value == true then
if Unit then
--print("x")
Unit:SetPrimaryPartCFrame(Unit.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0))
end
end
end
end
end)
I tried searching for problems like this one and I couldn’t find(only found a client-sided script to server-sided model solution), if this is a duplicated topic please reply and I’ll close this one.
The piece of code is inside the ModuleScript and it is being required by a LocalScript.
I know it reaches the Unit:SetPrimaryPartCFrame(Unit.PrimaryPart.CFrame * CFrame.Angles(0, math.rad(90), 0)) because it prints the “x”.
UIS.InputBegan:Connect(function(inputObject)
if inputObject.UserInputType == Enum.UserInputType.Keyboard then
local value = inputObject.KeyCode.Value
if value == 114 then
if script.Parent.Configuration.UnitEditor.Value == true then
if Unit then
Unit:SetPrimaryPartCFrame(Unit:GetPrimaryPartCFrame() * CFrame.Angles(0, math.rad(90), 0))
print(Unit.PrimaryPart.CFrame)
end
end
end
end
end)