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

How do i make when someone touch a part his name will display on the ui?

local TimerDisplay = game.StarterGui.TimerGui.TimerDisplay
local part = script.Parent

local Display = game.StarterGui.TimerGui.TimerDisplay

script.Parent.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	
	if player then
		
		Display.Text = player.Name.." wins!"
		
		player.leaderstats.Wins.Value += script.Parent.ToAddWins.Value
		player.leaderstats.Cash.Value += script.Parent.ToAddMoney.Value
		
		wait()
	end
end)

when i try to do that script it only adds the win value not both and not displaying the player name who touch the part

`

1 comment

0

The player's UI is located in the PlayerGui folder inside the player object. It's not in StarterGui.

1 answer

local part = script.Parent
local sht = part.ToAddWins
local shp = part.ToAddMoney
local Status = game:GetService("ReplicatedStorage"):WaitForChild("Status")

part.Touched:Connect(function(hit)
	local player = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
	
	player.leaderstats.Wins.Value += sht.Value
	player.leaderstats.Cash.Value += shp.Value
	
	Status.Value = player.Name.. " wins!"
	
	wait(5)
	
end)

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