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

Why does this script delay a part by one second?

Asked by 7 years ago

It works at first but then 1 second later it teleports, even when I'm not touching it?

01local table = {
02    "Player1",
03    "",
04    ""
05}
06cooldown = false
07place = workspace.ToSpawn
08script.Parent.Touched:connect(function(hit)
09    if game.Players:GetPlayerFromCharacter(hit.Parent) and (not cooldown) then
10        cooldown = true
11        local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
12        local chr = plr.Character
13        for i,v in pairs(table) do
14            if plr.Name == v then
15                script.Parent.CanCollide = false
View all 28 lines...

Not sure at all, is it waiting then going back to it?

0
Nothing seems wrong with your script, its probably just the server registering the hit a little bit late. User#17125 0 — 7y
0
connect is deprecated. Use Connect. Thundermaker300 554 — 7y
0
thunder pls don't lose sleep over a dumb capitalization quirk cabbler 1942 — 7y

1 answer

Log in to vote
0
Answered by
lukedm 0
7 years ago

In line 17 you have a wait for one second, to reduce the time, make it 0.0000001 seconds

Ad

Answer this question