Basically, when you touch a brick you are supposed to be shown a popup GUI that turns off after 10 seconds, I've looked up multiple tutorials however nothing seems to be working.
The RemoteEvent is named and is in ReplicatedStorage "ShowGui"
The Gui itself is also in Replicated Storage named "PlayerWin"
there is also a local script inside
local Players = game:GetService("Players") local ReplicatedStorage = game:GetService("ReplicatedStorage") local player = Players.LocalPlayer local GuiWinner = ReplicatedStorage:WaitForChild("GuiWinner") local playerGui = player:WaitForChild("PlayerGui") local PlayerWin = ReplicatedStorage:WaitForChild("PlayerWin") PlayerWin.Parent = playerGui local function onWelcomePlayerFired() PlayerWin.Frame.Visible = true wait(10) PlayerWin.Frame.Visible = false end PlayerWin.OnClientEvent:Connect(onWelcomePlayerFired)
And the brick itself has a script inside as well
local Part = script.Parent Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then wait(10) humanoid.Health = 0 end end) local Players = game:GetService("Players") local GuiWinner = Instance.new("RemoteEvent") GuiWinner.Parent = game.ReplicatedStorage GuiWinner.Name = "GuiWinner" local function onPlayerAdded(player) GuiWinner:FireClient(player) end Players.PlayerAdded:Connect(onPlayerAdded)
For any further questions please leave a comment, thanks.
You can do this like this: Script in brick:
local Event = game.ReplicatedStorage:WaitForChild("ShowGui") script.Parent.Touched:Connect(function(hit) if debounce == true then debounce = false if hit.Parent:FindFirstChild("Humanoid") and game.Players:GetPlayerFromCharacter(hit.Parent) then local Player = game.Players:GetPlayerFromChracter(hit.Parent) Event:FireClient(Player) end wait(3) debounce = true end end)
Put the GUI in StarterGui to have it given to players on spawn. Local script in GUI:
local Event = game.ReplicatedStorage:WaitForChild("ShowGui") local Frame = script.Parent:WaitForChild("Frame") Frame.Visible = false Event.OnClientEvent:Connect(function() Frame.Visible = true wait(10) Frame.Visible = false end)
local Part = script.Parent local Players = game:GetService("Players") local remote = game.ReplicatedStorage.GuiWinner -- im asumming u named it GuiWinner u will have to change it if u diddnt Part.Touched:Connect(function(hit) local humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid then -- if the thing that touches the part has a humanoid in it it will try to find a player and fire a remote local player = Players[hit.Parent.Name] -- Getting the player u are searching for Hit.Parent.Name in game.Player GuiWinner:FireClient(player)--Fires the remote end end)
In the local script 1. u want to make a screengui in playergui u cant see frames or anything if its not in a screengui 2. u diddnt use a remote to use OnClientEvent u used a ui
local ReplicatedStorage = game:GetService("ReplicatedStorage") local GuiWinner = ReplicatedStorage:WaitForChild("GuiWinner") local Players = game:GetService("Players") local player = Players.LocalPlayer local function onWelcomePlayerFired() local playerGui = player:WaitForChild("PlayerGui") local screengui = Instance.new("ScreenGui") -- making a screen gui screengui.Parent = playerGui local PlayerWin = ReplicatedStorage:WaitForChild("PlayerWin"):Clone() -- i assume u want to use this multiple times so u should probably clone this PlayerWin.Parent = screengui -- parenting it to screengui PlayerWin.Frame.Visible = true wait(10) PlayerWin.Frame.Visible = false end GuiWinner.OnClientEvent:Connect(onWelcomePlayerFired) -- using a remote to use OnClientEvent
I hope this works i havent test it so im not sure i also hope i explained enoufh :).