Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by
xp5u 25
3 years ago
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

Log in to vote
0
Answered by 3 years ago
Edited 3 years ago
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)


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? xp5u 25 — 3y
0
my bad the tl variable was the textlabel let me edit that MLGwarfare04 183 — 3y
Ad

Answer this question