0

# How to make a local part appear when tool is equipped?

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)



0

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.

0
Thanks for the reply, unfortunately, this didn't work. Mkoalko 0 — 7y
0
Are you sure? Archonious2 160 — 7y
0
I can't see any errors with the bits I added in. Archonious2 160 — 7y