I am trying to make a tool which, when equipped, creates a localpart (one only seen by the local player) and I am kind of stuck.
sp=script.Parent equipped=false function onEquipped(mouse) equipped=true local player = game.Players.LocalPlayer local character = player.Character local bin = Instance.new("Message") bin.Name = 'LocalBin' bin.Parent = character local platform = Instance.new("Part") platform.CFrame = character.Torso.CFrame * CFrame.new(0, -3, 0) platform.Anchored = true platform.Size = Vector3.new(10, 1.2, 10) platform.Parent = bin end function onUnequipped() equipped=false game.Players.LocalPlayer.Character.LocalBin:remove() end sp.Equipped:connect(onEquipped) sp.Unequipped:connect(onUnequipped)
Thanks in advance!
Fixed it for you:
sp=script.Parent equipped=false local Cam = Workspace.CurrentCamera function onEquipped(mouse) equipped=true local player = game.Players.LocalPlayer local character = player.Character local platform = Instance.new("Part") platform.Name = "ThePart" platform.CFrame = character.Torso.CFrame * CFrame.new(0, -3, 0) platform.Anchored = true platform.Size = Vector3.new(10, 1.2, 10) platform.Parent = Cam end function onUnequipped() equipped=false Cam.ThePart:Destroy() end sp.Equipped:connect(onEquipped) sp.Unequipped:connect(onUnequipped)
It will only be seen by the local player because anything put locally into CurrentCamera can only be seen by the client. A handy trick to know.
There was 23 lines. You might not have copied all of the code.