#why is this doing legit nothing

1 messages · Page 1 of 1 (latest)

odd musk
#
local uis = game:GetService("UserInputService")
local timeevent = game.ReplicatedStorage.Events:WaitForChild("timeAbility")
local tool = script.Parent

local isEquipped = false

local function timeEvent()
uis.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.E then
        timeevent:FireServer()
    end
end)
end

tool.Equipped:Connect(function()
    isEquipped = true
    timeEvent()
end)

tool.Unequipped:Connect(function()
    isEquipped = false
    print("Tool Not Equipped")
end)
#

is this cause i have the input inside a local function

delicate halo
#

Well uh

#

First of all variables are case sencative

#

You did timeevent and then timeEvent rhey r not rhe same

#

Second if thats a remote event

odd musk
#

i already have a script for if the remote is fired and it works

#

if i have a tool out the input will work

#

but if i dont it doesnt

delicate halo
#

Wai i didint read the code fully mb 😭

odd musk
#

yh i think its cause it only runs the timeEvent function once

delicate halo
#

Yea also dont forget to disconect and reconect the uis

odd musk
#

i lowk dont know how or where to do that

#

i have an idea

#

like tool.Unequipped:Connect(function()

#

then it disconnects the uis

#

but in

#

tool.Equipped:Connect(function()

#

then reconnect it

#

or sum

#

idk

quasi prairie