Still have questions? Join our Discord server and get real time help.
-3

# How do I make a Text go 1 Up? [NOT SOLVED]

I want a text to go up by 1 when you touch a brick. But I don't know how. Here's what I have:

local player = game.Players.LocalPlayer
function Touched()
player.PlayerGui.ScreenGui.TextLabel.Text = +1
end

game.Players.LocalPlayer.Touched:connect(Touched)


0
Tesouro 407
6 years ago

There are two errors in that script: touches is a number value and Text has to be a string value, you can't mix them and LocalPlayer is a player, you have to connect the body parts to the function. Fix:

local player = game.Players.LocalPlayer
local touches = 0

function Touched()
touches = touches + 1
player.PlayerGui.ScreenGui.TextLabel.Text = tostring(touches) -- now it's a string
end

-- this will find the real body parts
for child, index in pairs (game.Players.LocalPlayer.Character:GetChildren()) do
if child:IsA("Part") then
child.Touched:connect(Touched)
end
end

0
Doesn't work at all. DDDropTheBase 0 — 6y
0
You sure? I see not errors in that. No output? Tesouro 407 — 6y
0
Nothing in the output, it just doesn't work... DDDropTheBase 0 — 6y
0
Is the locla script where it should be? In a player's Backpack (can be indirectly, through a Tool or HopperBin), in a player's character moel or in a player's PlayerGui. Tesouro 407 — 6y