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

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

Asked by
thifal2 14
1 year ago
Edited 1 year ago
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

`

0
The player's UI is located in the PlayerGui folder inside the player object. It's not in StarterGui. xInfinityBear 1777 — 1y

1 answer

Log in to vote
0
Answered by
thifal2 14
1 year ago
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)
Ad

Answer this question