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 :

function onKeyPress(actionName, userInputState, inputObject)
    if userInputState == Enum.UserInputState.Begin and A == false then
A = true
fadeout()--super long function so I didn't include it
wait(10)
fadein()--super long function so I didn't include it
wait(30)
A = false
    end
end
game.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

local A = false
function onKeyPress(actionName, userInputState, inputObject)--doesn't get past here
    if userInputState == Enum.UserInputState.Begin and A == false then
A = true
local rs = game:GetService("ReplicatedStorage")
local player = game.Players.LocalPlayer
local name = player.Name
local o = name.."swordout"
local f = rs.PlayerStuff
local so = f:FindFirstChild(o)
so:FireServer()
    wait(1)
A = false
    end
end
game.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