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

Why will this "Changed" event not function?

Asked by
RoboFrog 400 Moderation Voter
10 years ago

I've been working on a game that heavily relies on mouse input these past few days, and have hit a snare nearly immediately. I'm making a "tool" of sorts that works without being in a tool, but is just a localscript that is placed into StarterPack.

I've done a few tests, and local scripts do run correctly whilst in the backpack. However, this particular script isn't working out for me, and I don't see why it isn't --

mouse.Changed:connect(function(property)
    print("Changed!")
    if property == "Target" and mouse.Target then
        print("CheckWorked")
        Empty(mouse.Target);
    end
end);

function Empty(target)
    print("Empty")
end

I'll make it easy to tell how much is working... none of the prints even go off whenever I mouse over a brick. I've tried placing the script into StarterGui as well, to no avail.

Thank you for reading, and I hope to find a solution!

1
Empty probably needs to be defined before the event. And I don't think Target fires the Changed event. Tkdriverx 514 — 10y
0
Heh, I always forget about that... chronologically, it has never made sense to me. But that's strange, I could have sworn that was technically a property. Do you happen to know of any better alternatives than mouse moved? (which would probably create lag) RoboFrog 400 — 10y

Answer this question