I want to make a tool that summons a wall in front of the player. I already tried a script but it did not work, there was also no errors in the output.
here is my script
local tool = script.Parent
local bool = game.StarterPack.Build.Value
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local torso = player.Character.UpperTorso
--EQUIP--
tool.Equipped:connect(function()
bool.Value = true
end)
tool.Unequipped:connect(function()
bool.Value = false
end)
--WALL--
mouse.KeyDown:connect(function(key)
if key == "e" and bool.Value ==true then
print("Pressed e")
Wall = Instance.new("Part",game.Workspace)
Wall.Position = torso.Position + torso.Position + torso.CFrame.lookVector*5
end
end)

1 comment
It’s probably not working because you’re trying to parent a part to workspace by localscript, which won’t work. It might work if you parent it to the camera but that will only let the player with the tool see it.