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

Script works in Studio but not In-Game?

Asked by 9 years ago

I am trying to make a Model Delete tool, so far it works in Studio but not in-game. Can anyone tell me why this is? There is no output error.

bin = script.Parent
me = bin.Parent.Parent
Cursor = {}
Cursor["gun"] = "rbxasset://textures\\GunCursor.png"
Cursor["arrow"] = "rbxasset://textures\\ArrowCursor.png"
Cursor["reload"] = "rbxasset://textures\\GunWaitCursor.png"
Cursor["hammer"] = "rbxasset://textures\\HammerCursor.png"

function Idle(mouse)

end

function getkey(key, rkey)
if key == rkey then
return true
else
return false
end
end


function keypush(key)
key = key:lower()

end

function onButton1Down(mouse)
local t = mouse.Target
if t == nil then return end
if t.Locked == true then return end
if t.Parent.className ~= "Model" then return end
t.Parent:Remove()
end

function onButton1Up(mouse)

end

function onSelected(mouse)
    mouse.Icon = Cursor["gun"]
    mouse.Button1Down:connect(function() onButton1Down(mouse) end)
    mouse.Button1Up:connect(function() onButton1Up(mouse) end)
    mouse.Idle:connect(function() Idle(mouse) end)
    mouse.KeyDown:connect(keypush)
end
function deselect(mouse)

end


bin.Deselected:connect(deselect)
bin.Selected:connect(onSelected)

Answer this question