I have this script:
local c = nil local sB = script.Parent.SetButton local rB = script.Parent.RemoveButton local char = game.Players.LocalPlayer.Character sB.MouseButton1Click:connect(function() c = char.Torso.CFrame if(char.LocalBin:FindFirstChild("WaypointMarker")) then char.LocalBin.WaypointMarker:Destroy() end m = game.Lighting.WaypointMarker:Clone() m.CFrame = c m.Parent = char.LocalBin end) rB.MouseButton1Click:connect(function() char.LocalBin.WaypointMarker:Destroy() end)
Just to clarify the waypoint marker is a Part with a Script inside it that makes it spin, also sB and rB are text buttons. What it does is once you click the button it clones the Part to your Torso and then once you click the second button it removes it. If you click the second button twice it removes the first Part. This works fine in Studio but the Part doesn't show up in the actual game. At the moment you can test it here.
.
local c = nil local sB = script.Parent.SetButton local rB = script.Parent.RemoveButton local char = game.Players.LocalPlayer.Character sB.MouseButton1Click:connect(function() c = char.Torso -- you cannot call a CFrame without CFraming anything, so we just call the part if(char.LocalBin:FindFirstChild("WaypointMarker")) then char.LocalBin.WaypointMarker:Destroy() end m = game.Lighting.WaypointMarker:Clone() m.CFrame = c.CFrame -- we add CFrame here m.Parent = char.LocalBin end) rB.MouseButton1Click:connect(function() char.LocalBin.WaypointMarker:Destroy() end)