Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make a ScreenGui apear when a player steps on a brick?

i have been trying to do this for a while but every tutorial on youtube does not work and i need help i dont know how to do this but this is the last script i entered

script.Parent.Touched:connect(function(hit)

if hit.Parent:FindFirstChild("Humanoid") then

game.Players.LocalPlayer.ScreenGui.Frame.Visible=true

end

end)

idk what to do for this and its really annoying going from tutorial after tutorial and them not working. if somebody can get me a working script that would be really helpful

2 comments

0

btw im trying to make a simulator shop

0

Make sure you're using a local script for this and if you're going find the frame the way you're finding it instead of "game.Players.LocalPlayer.ScreenGui.Frame.Visible = true" do "game.Players.LocalPlayer.PlayerGui.ScreenGui.Frame.Visible = true"

1 answer

✓ Accepted answer

General Practice

ScreenGui s should be placed inside the StarterGui, where they will be relocated in-game to the PlayerGui under the Player

Use :WaitForChild() to make sure a part exists before using / changing it

Issues

connect is deprecated in favor of Connect

Server Scripts cannot call the LocalPlayer, and cannot access / read from the PlayerGui, you need to use a LocalScript instead.

Revised LocalScript under the ScreenGui

local player = game:GetService("Players").LocalPlayer
local part = workspace:WaitForChild("ShopPart")

part.Touched:Connect(function(hit)
    if hit.Parent:FindFirstChild(“Humanoid”) then
	    script.Parent:WaitForChild("Frame").Visible = true
    end
end)

In the above example, the part that connects the function is a part under the Workspace named "ShopPart"

This discussion is preserved as it was. New answers, comments, and votes are closed.