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

How to show the winning players name?

Hello I am trying to make a system close to the one in rage runner where your name is displayed if you win

i have made a script that will add a win when you hit a part but i want the winning players name to be shown to everyone as well.

this is what i have done so far

local player = game:GetService("Players")
local pad = script.Parent -- Path to coin
local notify = game.ReplicatedStorage.Notify

local used = false

function giveCoin(part)
	if part.Parent:FindFirstChild("Humanoid") == nil or used == true then
		return
	end
	used = true
	local player = player:GetPlayerFromCharacter(part.Parent)
	player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1

	pad:Destroy()
end

pad.Touched:Connect(giveCoin)


the notify variable is a stringValue in replicated storage and i want the value of notify to change to the players name when they hit the block

can you help me

thanks :)

1 answer

local player = game:GetService("Players")
local pad = script.Parent -- Path to coin
local notify = game.ReplicatedStorage.Notify

local used = false

function giveCoin(part)
    if part.Parent:FindFirstChild("Humanoid") == nil or used == true then
        return
    end
    used = true
    local player = player:GetPlayerFromCharacter(part.Parent)
    player.leaderstats.Wins.Value = player.leaderstats.Wins.Value + 1

    notify.Value = player.Name -- just sets the value of your string to the name of the player! :) Easy!

    pad:Destroy()
end

pad.Touched:Connect(giveCoin)


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