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

Why does my dab script works in studio, but not in the actual game?

Asked by 7 years ago

I have created a dab script (for a meme club house.) It works in roblox studio so I decided to show it to the owner of it. It didn't work so I checked the error log. There was nothing.

local Mouse
local d = 0
function onClick()
    if d == 0 then
    d=1
    local dab = script.Parent.Parent.Humanoid:LoadAnimation(script.Parent.Animation)
    dab:Play()
    wait(1.5)
    print "done"
    d=0
    end
end

function onEquip(a)
    if Mouse == nil then
    Mouse = a
    Mouse.Button1Down:connect(onClick)
    end
end

script.Parent.Equipped:connect(onEquip)

1 answer

Log in to vote
0
Answered by 7 years ago

On line 17 it would be:

MouseButton1Down:connect(onClick)

If Mouse was a gui button it would be:

local button = script.Parent

button.MouseButton1Down:connect(function()
    -- code here
end)

So it's not Mouse.Button1Down instead it's MouseButton1Down .

I don't think that fixes it but it's worth a try.

Ad

Answer this question