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

Proximityprompt opening gui issue?

Asked by 2 years ago

I made a thing in my roblox game where if you trigger a proximity prompt a gui should be enabled and you cant jump, but when I trigger the proximity prompt it doesnt show up and i can still jump is this an issue with how i active the proximity prompt or am I doing something else incorrectly?

this is my code

proximityPrompt = game.Workspace.pizzadougharea.CuttingBoard:WaitForChild("ProximityPrompt")
timingGUI = game.StarterGui.doughtiming

players = game:GetService("Players")
starterPlayer = game:GetService("StarterPlayer")
local userInput = game:GetService("UserInputService")

proximityPrompt.Triggered:Connect(function()
    timingGUI.Enabled = true
    starterPlayer.CharacterJumpHeight = 0

    if input.KeyCode == Enum.KeyCode.Space then
        print("player pressed space")
        timingGUI.Enabled = false
    end 

end)

2 answers

Log in to vote
0
Answered by
LazokkYT 117
2 years ago

StarterGui is where gui gets transferred into every player's playergui when the game starts, so you can't use game.StarterGui on the client. You should've instead referenced the localplayer's gui. Also, that's not how you detect a key press.

enabled = false
proximityPrompt = game.Workspace.pizzadougharea.CuttingBoard:WaitForChild("ProximityPrompt")
timingGUI = game.Players.LocalPlayer.PlayerGui.doughtiming

players = game:GetService("Players")
starterPlayer = game:GetService("StarterPlayer")
local userInput = game:GetService("UserInputService")

proximityPrompt.Triggered:Connect(function()
    enabled = true  
    timingGUI.Enabled = true
    starterPlayer.CharacterJumpHeight = 0

end)
userInput.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Space then
        if enabled == true then
            print("player pressed space")
            timingGUI.Enabled = false
        end
    end
end)
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago
enabled = false
proximityPrompt = game.Workspace.pizzadougharea.CuttingBoard:WaitForChild("ProximityPrompt")
timingGUI = game.Players.LocalPlayer.PlayerGui.doughtiming

players = game:GetService("Players")
starterPlayer = game:GetService("StarterPlayer")
local userInput = game:GetService("UserInputService")

proximityPrompt.Triggered:Connect(function()
    enabled = true  
    timingGUI.Enabled = true
    timingGUI.Frame.visible = true
    starterPlayer.CharacterJumpHeight = 0

end)
userInput.InputBegan:Connect(function(input)
    if input.KeyCode == Enum.KeyCode.Space then
        if enabled == true then
            print("player pressed space")
            timingGUI.Enabled = false
        end
    end
end)

Answer this question