so im making an easter egg in my game and there is a part that changes text label text But only for the player who touched the brick. Yes the script is in starter gui.
local part = game.Workspace.special.evenmorespecial.secret part.Touched:Connect(function() local text1 = "..." local text2 = "why would someone like this come here?" local text3 = "hmm?" local text4 = "i guess you dont like to talk." local text5 = "... or you are a bit shocked?" local text6 = "you probably got here by accident... just like i did..." local text7 = "well, i didn't see a single human for years!" local text8 = "i'll reward you with the ability to spawn the green dirt." local text9 = "bye!" local text = game.StarterGui.TFlaniganDialogue.d1 wait(1) for i = 1, #text1 do text.Text = string.sub(text1, 1, i) wait(0.04) end wait(3) for i = 1, #text2 do text.Text = string.sub(text2, 1, i) wait(0.04) end wait(4) for i = 1, #text3 do text.Text = string.sub(text3, 1, i) wait(0.04) end wait(3) for i = 1, #text4 do text.Text = string.sub(text4, 1, i) wait(0.04) end wait(4) for i = 1, #text5 do text.Text = string.sub(text5, 1, i) wait(0.04) end wait(3) for i = 1, #text6 do text.Text = string.sub(text6, 1, i) wait(0.04) end wait(3) for i = 1, #text7 do text.Text = string.sub(text7, 1, i) wait(0.04) end wait(3) for i = 1, #text8 do text.Text = string.sub(text8, 1, i) wait(0.04) end wait(4) for i = 1, #text9 do text.Text = string.sub(text9, 1, i) wait(0.04) end end)
Well you can put the touched event in a serverscript and use a remote event to fire a signal to the client, then use OnClientEvent to handle the request.
Examples:
-- Server Script part.Touched:Connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then local plr = game.Players:GetPlayerFromCharacter(hit.Parent) remoteEvent:FireClient(plr) end end)
-- Client script in startergui remoteEvent.OnClientEvent:Connect(function() -- your easter egg code here end)
On the same local script do
Local variable = what the local part's name is If variable.touched:connect(function () Print("or code goes here") end)