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

Issue displaying the player who purchased the nuke and onto a starter gui. Any solutions?

local local_plr = game:GetService("Players").LocalPlayer.Name
game.ReplicatedStorage.GUI.OnClientEvent:Connect(function()
	script.Parent.TextTransparency = 0
	script.Parent.Text = local_plr
	wait(0.1)
	script.Parent.Text = (local_plr .. " H")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HA")
	wait(0.1)

	script.Parent.Text = (local_plr .. " HAS")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS S")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SE")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SEN")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT O")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OU")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT A")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT A N")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT A NU")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT A NUK")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT A NUKE")
	wait(0.1)
	script.Parent.Text = (local_plr .. " HAS SENT OUT A NUKE!")

	wait(3)
	script.Parent.Text = ""


end)
  • the main issue with this is that when the gui pops up after the gamepass has been purchased it displays the localplayer.name for each individual player not the person who purchased the nuke.

It is a localscript in startergui

1 answer

✓ Accepted answer
local runserv = game:GetService("RunService")
local repstorage = game:GetService("ReplicatedStorage")
local nukemessage = "HAS SENT A NUKE!"
local tl = script.Parent

-- the argument (plr) in the function should be the player who bought the nuke so it replicates properly
repstorage:WaitForChild("GUI").OnClientEvent:Connect(function(plr)
	local nukemessage = plr.Name .. nukemessage
    script.Parent.TextTransparency = 0
   for i = 1,#nukemessage,1 do
	tl.Text = string.sub(nukemessage,1,i)
	runserv.Heartbeat:Wait()
   end
    wait(3)
    tl.Text = ""
    tl.TextTransparency = 1

end)


2 comments

0

Ok, so the text message is displayed but when I run the remoteevent, tl is undefined. Do I just change it into script.Parent?

0

my bad the tl variable was the textlabel let me edit that

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