Name = script.Parent.Value.Value function onTouched(hit) if hit.Parent:FindFirstChild("Humanoid") then local character = hit.Parent:FindFirstChild("Humanoid") local plr = game.Players:GetPlayerFromCharacter(character) if plr then local value = math.random(1, 5) plr.PlayerGui.Number.TextLabel.Text = "Your number is " .. Name plr.PlayerGui.Number.TextLabel.Visible = true wait(6) plr.PlayerGui.Number.TextLabel.Visible = false end end end script.Parent.Touched:connect(onTouched)
The first thing you did wrong was making the character variable the humanoid. 2nd you named value, which could be ommited (taken out) since it is n't used. 3rd I suggest you add a wait in to make sure you don't keep getting numbers. Here is what I came up with.
Name = script.Parent.Value db=false function onTouched(hit) if db==false then db=true if hit.Parent:FindFirstChild("Humanoid") then local character = hit.Parent local plr = character.Parent if plr then Name.Value = math.random(1, 5) plr.PlayerGui.Number.TextLabel.Text = "Your number is " .. Name plr.PlayerGui.Number.TextLabel.Visible = true wait(6) plr.PlayerGui.Number.TextLabel.Visible = false end end db=false end end script.Parent.Touched:connect(onTouched)