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

Why does this script stop another script from working when in the player's Character?

Asked by
Viking359 161
7 years ago

I have a local script that turns players invisible :

01function onKeyPress(actionName, userInputState, inputObject)
02    if userInputState == Enum.UserInputState.Begin and A == false then
03A = true
04fadeout()--super long function so I didn't include it
05wait(10)
06fadein()--super long function so I didn't include it
07wait(30)
08A = false
09    end
10end
11game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.E)

When I put in in StarterCharacterScripts it works fine, but then my dagger local script(in a tool) stops working

01local A = false
02function onKeyPress(actionName, userInputState, inputObject)--doesn't get past here
03    if userInputState == Enum.UserInputState.Begin and A == false then
04A = true
05local rs = game:GetService("ReplicatedStorage")
06local player = game.Players.LocalPlayer
07local name = player.Name
08local o = name.."swordout"
09local f = rs.PlayerStuff
10local so = f:FindFirstChild(o)
11so:FireServer()
12    wait(1)
13A = false
14    end
15end
16game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.Q)

If I move the invisibility scripts out of the character it stops working and the dagger script starts working. What's wrong with my scripts?

0
I would like to see the fadeout() function because it may have something to do with the daggar script.. greatneil80 2647 — 7y

Answer this question