Hello i am having issue with rotation with model basically it rotate object but it always go back again
here is showcase
local Placement = {}
Placement.Startplacing = function(object)
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Slot = Player:GetAttribute("Slot")
local UIS = game:GetService("UserInputService")
local GridSize = 1
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R then
object:SetPrimaryPartCFrame(object.Primary.CFrame * CFrame.Angles(0, math.rad(90), 0))
end
end)
Mouse.Button1Down:Connect(function()
if Player:GetAttribute("IsBuilding") == true then
if object:GetAttribute("Collision") == false then
place = object:Clone()
place.Primary.CFrame = object.Primary.CFrame
place.Parent = workspace.BuildMode.Placed
place.HitBox.SelectionBox.Visible = false
end
end
end)
while Player:GetAttribute("IsBuilding") == true do
wait(0.1)
Mouse.TargetFilter = object
object:SetPrimaryPartCFrame(CFrame.new(math.floor(Mouse.Hit.X / GridSize) * GridSize, workspace:FindFirstChild(Slot).Borders.Grid.Position.Y + 1, math.floor(Mouse.Hit.Z / GridSize) * GridSize))
end
end
return Placement
sorry if this is something related to me being stupid heh
local Placement = {}
Placement.Startplacing = function(object)
local Player = game.Players.LocalPlayer
local Mouse = Player:GetMouse()
local Slot = Player:GetAttribute("Slot")
local UIS = game:GetService("UserInputService")
local GridSize = 1
local Rotation = 0
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.R then
Rotation = Rotation + 1
end
end)
Mouse.Button1Down:Connect(function()
if Player:GetAttribute("IsBuilding") == true then
if object:GetAttribute("Collision") == false then
place = object:Clone()
place.Primary.CFrame = object.Primary.CFrame
place.Parent = workspace.BuildMode.Placed
place.HitBox.SelectionBox.Visible = false
end
end
end)
while Player:GetAttribute("IsBuilding") == true do
wait(0.1)
Mouse.TargetFilter = object
object:SetPrimaryPartCFrame(CFrame.new(math.floor(Mouse.Hit.X / GridSize) * GridSize, workspace:FindFirstChild(Slot).Borders.Grid.Position.Y + 1, math.floor(Mouse.Hit.Z / GridSize) * GridSize) * CFrame.Angles(0, math.rad(90*Rotation), 0))
end
end
return Placement