Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

My Script is not outputting errors, but it doesn't work at all. I could use some help...?

Asked by 5 years ago
Edited 5 years ago

My script is not working properly, these scripts are apart of a tool names metal. The way the script works is similar to telekinesis. When you click it it's suppose to hold it in the air for a while (Grab), and then when you click again it is suppose to throw it. The point of this script is that it will only work if the parts name is metal. But for some reason no output errors it just doesn't work. My check at the end of the Local script prints just fine though. Weird!

LOCAL SCRIPT

--//Variables\\--

local debounce = false

local player = game:GetService("Players").LocalPlayer

local mouse = player:GetMouse()

local m = mouse.Target



--//Script Settings\\-

script.Parent.Equipped:Connect(function(mouse)

mouse.Button1Down:Connect(function()

local targ = mouse.Target

if targ.Name == "Metal" then

if debounce == false then debounce = true

script.Parent.Grab:FireServer(targ,m)

mouse.Button1Down:Connect(function()

local Hit = mouse.Hit

script.Parent.Throw:FireServer(Hit)

script.Parent.Sound:Play()

wait(2)

debounce = false

end)

end

end

end)

end)



print (2*5)

REGULAR SCRIPT

    script.Parent.Grab.OnServerEvent:Connect(function(player,targ,m)

if targ then

local BP = Instance.new("BodyPosition")

BP.MaxForce = Vector3.new(math.huge,math.huge,math.huge)

BP.Parent = targ

BP.Position = player.Character.UpperTorso.Position + Vector3.new(0,6,-3)

script.Parent.Throw.OnServerEvent:Connect(function(player,Hit)

BP.Position = player.Character.Head.Position + (Hit.p - player.Character.Head.Position).unit * 65

wait(0.5)

BP:Destroy()

end)

wait(4)

BP:Destroy()

end

end)

THE TOOL IMAGE - https://gyazo.com/755c9680c250cfec1834db6d04950314

Please help!

Answer this question