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

Making a pop-up GUI, script doesn't function properly yet no errors, why?

Asked by
BryanFehr 133
5 years ago
Edited 5 years ago

I've recently been working on a Z-style shooter game, and I've been having serious trouble with a pop up gui I've been trying to add. It should function if the player touches a brick, it will pop-up. As I've tried to get it to work, and searched lots of extra help online, and none of the things I've found have seemed to work. Here is my code: ~~~~~~~~~~~~~~~~~ `local Part = script.Parent

Part.Touched:connect(function(HIT) local H = HIT.Parent:FindFirstChild("Humanoid") if H then local Player = game.Players:GetPlayerFromCharacter(HIT.Parent) Player.PlayerGui.Gamepass.Frame.Visible = true end end)

~~~~~~~~~~~~~~~~~

As the GUI is in the Starter GUI names 'Gamepass'

1 answer

Log in to vote
0
Answered by 5 years ago
local Part = script.Parent
Part.Touched:Connect(function(HIT)  -- :connect is depreciated
local H = HIT.Parent:FindFirstChild("Humanoid") 
if H then 
local player= game:GetService("Players"):GetPlayerFromCharacter(HIT.Parent)             player:GetService("PlayerGui").Gamepass.Frame.Visible = true 
end 
end)

I think youl code should still run the same but just try this and see if it does anything. If it doesnt then double check if humanoid is inside ur player or if you're actually touching script.Parent

0
Thank you for your response! When the Player touches it, it doesn't show still. The character does have a humanoid inside it and it is touching the part, the script says 'running' but nothing shows! BryanFehr 133 — 5y
0
Maybe check if the GUI is enabled or something thats causing it not to show up on ur screen windstrike 27 — 5y
Ad

Answer this question