#tp to spawn

1 messages · Page 1 of 1 (latest)

simple hamlet
#

can someone help me make the tp to spawn take 5 seconds and not instantly

fossil vale
simple hamlet
simple hamlet
#

how i do that

fossil vale
#

look at the docs

simple hamlet
#

what do i look for on there

fossil vale
#

task.delay...

simple hamlet
#

ok mb

#

i found it i think but it says 5 hello word

potent treeBOT
#

studio** You are now Level 1! **studio

simple hamlet
#

local thread = task.delay(5, function()
print("Hello world!")
end)

task.cancel(thread)

fossil vale
#

Scroll up

#

that just shows you how to cancel a task.delay (or any thread to be frank)

simple hamlet
#

delay(0)

#

thats the only thing?

simple hamlet
fossil vale
#

reading sure is difficult

simple hamlet
#

but what the script and where on the gui do i put it

fossil vale
simple hamlet
#

i know how do read i js needed ur attention

ripe basin
ripe basin
#

yeah just put your tp stuff into a task.delay function

#

and the number up top is the delay in seconds

simple hamlet
#

so i keep the blahs?

ripe basin
simple hamlet
#

where d oi place this script

ripe basin
#

okay, show me your script rn that tps the player on click

ripe basin
simple hamlet
#

local plr = script.Parent.Parent.Parent.Parent.Parent
local char = plr.Character

script.Parent.MouseButton1Click:Connect(function()
char.HumanoidRootPart.CFrame = workspace.nos.CFrame
end)

ripe basin
#
local plr = script.Parent.Parent.Parent.Parent.Parent
local char = plr.Character

script.Parent.MouseButton1Click:Connect(function()
    task.delay(5, function()
        char.HumanoidRootPart.CFrame = workspace.nos.CFrame 
    end)
end)
#

do you see what I did?

simple hamlet
#

so i copy that one and replace it

potent treeBOT
#

studio** You are now Level 2! **studio

ripe basin
#

also, what you could've done is this:

local plr = script.Parent.Parent.Parent.Parent.Parent
local char = plr.Character

script.Parent.MouseButton1Click:Connect(function()
    task.wait(5)
    char.HumanoidRootPart.CFrame = workspace.nos.CFrame 
end)
ripe basin
#

how long have you been scripting?

simple hamlet
#

i did a lot in 2020 but quit and just came back a few days ago

ripe basin
#

okay, just make sure to keep up with coding, and I agree with the other guy, learning to read documentation and really understand how parts of the roblox engine works is important

simple hamlet
#

okay i apreciate it, but one last thing is it a whole other script to make it count down from 5? so people know

ripe basin
#

like you want text so show it counting down?

simple hamlet
#

yes

#

so they know it works but takes a few seconds

ripe basin
simple hamlet
#

what do you mean?

ripe basin
#

is the script that you teleport your player with, a server or client script?

simple hamlet
#

not sure ngl

#

i just copied yours

ripe basin
#

okay

potent treeBOT
#

studio** You are now Level 3! **studio

ripe basin
#

did you paste it into a server or local script?

simple hamlet
#

its a local script

ripe basin
#

Okay I'd recommend watching this vid if you want more info, but right now your script has a massive problem, where the player is only getting teleported on their screen

#

in Roblox there is the server and the client, and since what your doing is running on a client script, your player isn't actually teleporting on the server

simple hamlet
#

so local script is client sided?

#

only i see it

ripe basin
#

so what you need to do is keep that local script right, and make it create a new gui with text and have it count down, and also fire to the server once it's done

ripe basin
simple hamlet
#

i just tested it, my brother sees me tp

ripe basin
simple hamlet
#

wheres that

ripe basin
#

right next to the "Play" button in roblox studio you can switch between server and client view

simple hamlet
#

ok now what

#

i see mysefl

ripe basin
#

when you click the teleport button on the client side and teleport you'll see that your location is different between the server and client view

#

Okay, I edited the script

local ReplicatedStorage = game:GetService('ReplicatedStorage')

local Player = script.Parent.Parent.Parent.Parent.Parent
local Character = Player.Character

local RemoteEvent = ReplicatedStorage.RemoteEvent -- replace this with where you put your remote event

script.Parent.MouseButton1Click:Connect(function()
    --have code here which adds in text to the gui
    for Counter = 5, 0, -1 do
        Label.Text = Counter -- Replace Label with whatever variable you made for a textlabel object
        task.wait(1)
    end

    RemoteEvent:FireServer(Player) -- make another script which is a server script that teleports the player
end)
#

you can copy this if you want, listen to the comments and follow them

#

this code will not work, it's just to show you what to do

simple hamlet
#

already have a tp script

ripe basin
simple hamlet
#

i have a tp script alreeady

#

u gave it to me

ripe basin
#

okay yeah but it doesn't change the players location on the server side

simple hamlet
#

it changed for my borther