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

Why won't this work?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

I am trying out KeyPress things and they won't work

function onKeyPress(actionName, userInputState, inputObject)
    if userInputState == Enum.UserInputState.Begin then
            wait(.1)
local a = Instance.new("Part", workspace)
a.TopSurface = "Smooth"
a.BottomSurface = "Smooth"
a.BrickColor = BrickColor.new("Black")
a.Name = "Plate"
a.Anchored = true
a.Size = Vector3.new(12,1,12)
a.Position = game.Players.LocalPlayer.Character.Torso.Position + Vector3.new(0,-5,0)
    wait(2)
    while true do
local a = game.Workspace.Plate
wait(-.10000)
a.Transparency = .1
wait(-.10000)
a.Transparency = .2
wait(-.10000)
a.Transparency = .3
wait(-.10000)
a.Transparency = .4
wait(-.10000)
a.Transparency = .5
wait(-.10000)
a.Transparency = .6
wait(-.10000)
a.Transparency = .7
wait(-.10000)
a.Transparency = .8
wait(-.10000)
a.Transparency = .9
wait(-.10000)
a:remove()
wait(5)
end
end
end


game.ContextActionService:BindAction("keyPress", onKeyPress, false, Enum.KeyCode.Z)

It will work in Roblox Studio but not on like Script Builder or the actual game.

0
Is this a LocalScript? User input stuff will only work from LocalScripts. adark 5487 — 9y

Answer this question