I want to trigger a client event when a brick is touched, I don't know what I'm doing wrong.
Server script inside server script service
game.Players:connect(function(player)
local event = Instance.new("RemoteEvent")
event.Parent = player
event.Name = "MyClientEvent"
if game.Workspace.PTV.Touched then
event:FireClient(player)
end
end)
Local script inside game.Workspace.PTV.ScreenGUI. PTV is a part.
game.Players.LocalPlayer:WaitForChild("MyClientEvent").OnClientEvent:connect(function()
local function PersonalTV() --My only question is how I want the event to be triggered and how I want this part to run when it is triggered, correcting me on this part is not necessary.
local imageLabel = Instance.new("ImageLabel")
imageLabel = script.Parent
imageLabel.Size = UDim2.new(0.25, 0, 0.25, 0)
imageLabel.Position = UDim2.new(1, 0, 1, 0)
imageLabel.Image = "rbxassetid://99995960"
local sound = Instance.new("Sound")
sound = "rbxassetid://198460934"
sound:Play()
wait(41.613)
sound:Stop()
wait(0.01)
imageLabel.Image = "rbxassetid://36169651"
sound = "rbxasssetid://223103466"
sound:Play()
wait(5)
sound:Stop()
wait(0.01)
imageLabel.Image = "rbxassetid://84899195"
sound = "rbxassetid://374355709"
sound:Play()
wait(53.237)
sound:Stop()
wait(0.01)
imageLabel.Image = "rbxassetid://36169651"
sound = "rbxasssetid://223103466"
sound:Play()
wait(5)
sound:Stop()
wait(0.01)
end
end)
Edit 1: I want a gui button instead that doesn't use a client event. StarterGui.ScreenGui.TextButton.RageQuitScript
local button = script.Parent
button:WaitForChild("Sound")
local function onButtonClick()
local imageLabel = Instance.new("ImageLabel")
imageLabel.Parent = script.Parent
imageLabel.Size = UDim2.new(0.25, 0, 0.25, 0)
imageLabel.Position = UDim2.new(0, 0, 0, 0)
imageLabel.Image = "rbxassetid://99995960"
local sound = Instance.new("Sound")
sound = "rbxassetid://198460934"
sound:Play()
wait(41.613)
sound:Stop()
wait(0.01)
imageLabel.Image = "rbxassetid://36169651"
sound = "rbxasssetid://223103466"
sound:Play()
wait(5)
sound:Stop()
wait(0.01)
imageLabel.Image = "rbxassetid://84899195"
sound = "rbxassetid://374355709"
sound:Play()
wait(53.237)
sound:Stop()
wait(0.01)
imageLabel.Image = "rbxassetid://36169651"
sound = "rbxasssetid://223103466"
sound:Play()
wait(5)
sound:Stop()
wait(0.01)
end
button.MouseButton1Click:connect(onButtonClick)
It isn't working, there is no error message.

10 comments
Thank you, I accidentally deleted it and never noticed. :L
The gui still isn't showing up, I added a print function and it still isn't showing up either. I might have placed the local script in the wrong place.
You indeed have. LocalScripts won't run in Workspace. You probably want to put the ScreenGui inside StarterGui instead.
I put the screengui inside startergui, it still isn't showing up
See my edited answer. Sorry for the delay.
It still isn't working, I gave you access via team create, don't destroy the whole thing ok :)
The link is https://www.roblox.com/games/421113879/In-development-2-why-are-you-still-here
I'm going to change it to be a surface gui that makes the PersonalTV on click
Instead I'm doing a screen gui
I'm starting a new question, that feels appropriate