I want to make a part rotate, but for some reason it doesn't work. How the UI gets to the player and disappears:
script.Parent.Equipped:Connect(function(mouse)
local rotation = game.ReplicatedStorage.Rotate:Clone()
rotation.Parent = game.Players.LocalPlayer.PlayerGui
c = script.Parent.Handle:Clone()
c.Parent = workspace
c.CanCollide = false
c.Anchored = true
c.Transparency = 0.3
script.Parent.Activated:Connect(function()
c.Position = mouse.Hit.Position
if c.Position.Y < 3.147 then
c.Position = Vector3.new(c.Position.X, 3.147, c.Position.Z)
end
end)
end)
script.Parent.Unequipped:Connect(function()
game.Players.LocalPlayer.PlayerGui:FindFirstChild("Rotation"):Destroy()
c.CanCollide = true
c.Transparency = 0
wait(1)
script.Parent:Destroy()
end)
Q (rotate left) script: (both are the same, E has 90 -90)
local special = {"Bed"}
script.Parent.MouseButton1Click:Connect(function()
local tool = game.Players.LocalPlayer.Character:FindFirstChildOfClass("Tool")
game.ReplicatedStorage.Rotation:FireServer(game.Players.LocalPlayer, tool.Handle, 90)
end)
Script:
script.Parent.OnServerEvent:Connect(function(player, object, Y)
object.CFrame = CFrame.Angles(0, math.rad(Y), 0)
end)
Any help to fix this problem?
