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

i am making a game in roblox with my friends but we are stuck on something?

Asked by 4 years ago

i am making a game in roblox with my friends but we cant figure out how to make it so that you hit the key "F" and then the value of an intvalue created in a sss script by +1. we have tried many scripts but none have worked! :(

0
first off, you might wanna write the entire name of that s script since tripple s refers to the nazis Gameplayer365247v2 1055 — 4y
2
No, SS refers to them. SSS stands for ServerScriptService Utter_Incompetence 856 — 4y

3 answers

Log in to vote
0
Answered by 4 years ago

I am writing this script thinking that the IntValue is inside the script

local intVal = script:WaitForChild("Value") --'Value' is the name of your value, you might need to change this
game:GetService("UserInputService").InputBegan:connect(function(inputObject, gameProcessedEvent)
     if inputObject.KeyCode == Enum.KeyCode.F then
       intVal.Value = intVal.Value + 1
     end
end)

This is similar to the previous answer, but it is simpler. I hope the fixes your problem

Ad
Log in to vote
0
Answered by
Nckripted 580 Moderation Voter
4 years ago

You look for a key using the following:

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.F then
        value.Value = value.Value + 1
    end
end
Log in to vote
-4
Answered by 4 years ago

you need userinputservice so

local uis = game:GetService("UserInputService")
uis.InputBegan:Connect(function(input,chat)--this checks every time you click down a key for what key it is 
    if input.KeyCode == Enum.KeyCode.F and not chat then--making sure they arent typing anything
        intvalue.Value = intvalue.Value + 1--just add on the value now
    end
end)

Answer this question