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

How can i make a variable change to true or false when left mouse is pressed?

Asked by 2 years ago

Hi, im trying to make a T-pose animation (like the one in JToH) and i couldn't find how to check for mouse inputs. I'm really new to Lua, but i have some experience with C+ and GML. I could get as far as this:

active = false
script.Parent.Equipped:connect(function()
    active = true
end)
script.Parent.Unequipped:connect(function()
    active = false
end)

(This is on a tool by the way. Sorry for my inexperience, i searched for a long time but this is my last resort.)

1 answer

Log in to vote
0
Answered by
xxaxxaz 42
2 years ago

make a remote event in replicatedstorage, rename it to itemequipped.

normal script in ServerScriptService:

if game.ReplicatedStorage.itemequipped:Fired()
    --do stuff
end

local script in tool:

active = false
script.Parent.Equipped:connect(function()
    active = true
end)
script.Parent.Unequipped:connect(function()
    active = false
end)
if active then
    game.ReplicatedStorage.itemequipped:Fire()
end

btw I might be wrong because I do not do much Fire() so most of this code is guesses but I want to help if I can.

0
ye i think it's supposed to be FireServer() instead of just Fire(), also to rubu make sure to disable the "RequireHandle" property on the tool caqc 0 — 2y
0
ok, thx I do not know much about fire-ing. xxaxxaz 42 — 2y
0
I'll try this asap, it looks like it'll work to me. just guessing tho. ruburubuy 0 — 2y
0
dont forget to do what caqc said, he knows more then me, I know nothing of this stuff. xxaxxaz 42 — 2y
View all comments (4 more)
0
oh and the serverscript should be game.ReplicatedStorage.itemequipped.OnServerEvent:Connect(function() instead of the if game.ReplicatedStorage.itemequipped:Fired() caqc 0 — 2y
0
ok xxaxxaz 42 — 2y
0
well i give up im not experienced enough to do this ruburubuy 0 — 2y
0
I think alvin blox teaches this to xxaxxaz 42 — 2y
Ad

Answer this question