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

How do I remove a player when he touches a brick and waits?

Asked by 10 years ago

here, im just bored and want to make another one of those fake free robux games. so heres the code im having trouble with.

------hopon44's script edited by TroytheDestroyer :3------
--                                                                                                                                              Local = ILOVEFREEMODELS  Game.Workspace.Model
debounce = false
function onTouched(hit)                                                                                                                             -- lel ignore that. it was just a personal joke.
if debounce == false then
debounce = true
msg = Instance.new("Message")
msg.Parent = game.Workspace
msg.Text = "loading Robux"
wait(1)
msg.Text = "loading Robux."
wait(1)
msg.Text = "loading Robux.."
wait(1)
msg.Text = "loading Robux..."
wait(1)
msg.Text = "loading Robux...."
wait(1)
msg.Text = "loading Robux..."
wait(1)
msg.Text = "loading Robux.."
wait(1)
msg.Text = "loading Robux."
wait(1)
msg.Text = "loading Robux"
wait(1)
msg.Text = "Entering exact amount"
wait(1)
msg.Text = "1"
wait(1)
msg.Text = "2"
wait(1)
msg.Text = "3"
wait(1)
msg.Text = "4"
wait(1)
msg.Text = "5"
wait(1)
msg.Text = "6"
wait(1)
msg.Text = "7"
wait(1)
msg.Text = "8"
wait(1)
msg.Text = "9"
wait(1)
msg.Text = "20"
wait(4)
msg.Text = "What? 20 robux and tix? "AWESOME" says the noob. anyway, make a place for 25 robux and PM me to buy it. Now BAI!"
wait (8)
msg:remove()
--debounce = falsemsg.Text = "ignore this scripters. i copied something wrong."
end
end
script.Parent.Touched:connect(onTouched)
-- what do i do to make it remove the player? i know how to but i dont know it's name. how do we find his name then kick him?
-- do you do that FirstFindChild function or what?
0
k. thanks but aren't we supposed to do Player:Remove() ? TroytheDestroyer 75 — 10y
0
Also, it said Hit is a nill value. TroytheDestroyer 75 — 10y

1 answer

Log in to vote
2
Answered by 10 years ago
--do a check to make sure its a Humanoid/Player first of all.

Debounce = false
function onTouched(Hit)
if Hit.Parent and Hit.Parent:FindFirstChil("Humanoid") and not Debounce then
local Player = game.Players:GetPlayerFromCharacter(Hit.Parent)
if Player then
Debounce = true
local Message = Instance.new("Message", Player.PlayerGui) --Makes it so only that one player see's the message.
Message.Text = ""
--Then do your waits, and continue on with messages.
--At the very end of your script do something like this.
wait(1)
Player:Destroy()
Debounce = false
end

Ad

Answer this question