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

01proximityPrompt = game.Workspace.pizzadougharea.CuttingBoard:WaitForChild("ProximityPrompt")
02timingGUI = game.StarterGui.doughtiming
03 
04players = game:GetService("Players")
05starterPlayer = game:GetService("StarterPlayer")
06local userInput = game:GetService("UserInputService")
07 
08proximityPrompt.Triggered:Connect(function()
09    timingGUI.Enabled = true
10    starterPlayer.CharacterJumpHeight = 0
11 
12    if input.KeyCode == Enum.KeyCode.Space then
13        print("player pressed space")
14        timingGUI.Enabled = false
15    end
16 
17end)

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.

01enabled = false
02proximityPrompt = game.Workspace.pizzadougharea.CuttingBoard:WaitForChild("ProximityPrompt")
03timingGUI = game.Players.LocalPlayer.PlayerGui.doughtiming
04 
05players = game:GetService("Players")
06starterPlayer = game:GetService("StarterPlayer")
07local userInput = game:GetService("UserInputService")
08 
09proximityPrompt.Triggered:Connect(function()
10    enabled = true 
11    timingGUI.Enabled = true
12    starterPlayer.CharacterJumpHeight = 0
13 
14end)
15userInput.InputBegan:Connect(function(input)
View all 22 lines...
Ad
Log in to vote
0
Answered by 2 years ago
Edited 2 years ago
01enabled = false
02proximityPrompt = game.Workspace.pizzadougharea.CuttingBoard:WaitForChild("ProximityPrompt")
03timingGUI = game.Players.LocalPlayer.PlayerGui.doughtiming
04 
05players = game:GetService("Players")
06starterPlayer = game:GetService("StarterPlayer")
07local userInput = game:GetService("UserInputService")
08 
09proximityPrompt.Triggered:Connect(function()
10    enabled = true 
11    timingGUI.Enabled = true
12    timingGUI.Frame.visible = true
13    starterPlayer.CharacterJumpHeight = 0
14 
15end)
View all 23 lines...

Answer this question