My tower will not rotate on client side when I press R
uis.InputBegan:Connect(function(input, processed)
if input.KeyCode == Enum.KeyCode.R then
print("Pressed R")
local primpart = place.PrimaryPart
primpart.CFrame = CFrame.Angles(0, 90, 0)
print(primpart.Orientation)
end
end)
It does print “Pressed R” and the Orientation, which is always the same
Nothing else is messing with the CFrame’s orientation except this:
runservice.RenderStepped:Connect(function()
if place then
local castpar = RaycastParams.new()
castpar.FilterType = Enum.RaycastFilterType.Blacklist
castpar.FilterDescendantsInstances = place:GetDescendants()
if uis.KeyboardEnabled == true and uis.MouseEnabled == true then --Mouse
getcast = castmouse()
elseif uis.KeyboardEnabled == true and uis.TouchEnabled == true then --Touch
if getcast == nil then
getcast = workspace:Raycast(camera.CFrame.Position, camera.CFrame.LookVector*1000, castpar)
end
elseif uis.TouchEnabled == true and uis.MouseEnabled == true then --Touch/Mouse
getcast = castmouse()
end
if getcast and getcast.Instance then
if getcast.Instance.Name ~= "CanPlaceOn" then
canPlace = false
else
canPlace = true
end
local x = getcast.Position.X
local y = getcast.Position.Y +(place.PrimaryPart.Size.Y) / 2 + place["Left Leg"].Size.Y
local z = getcast.Position.Z
local placecframe = CFrame.new(x, y, z)
local primpart = place.PrimaryPart
local orientation = primpart.CFrame.Rotation
place:SetPrimaryPartCFrame(placecframe * CFrame.Angles(orientation.X, orientation.Y, orientation.Z)) --I think this line is the problem
end
end
end)
What’s wrong?