#Teleport wont work or something wont work
116 messages · Page 1 of 1 (latest)
@carmine fog I’ll try to explain it as best as I can as I can tell that you’re new to scripting
So there is quite a lot wrong with the script, starting with the elephant in the room
If you want an aspect to change for all players then use a server script
ooo
The button is inside the UI so we do need a local script to get the input
So in your case we need 2 scripts
A local and a server script
ahhh
Starting off with the local script,all we need to do is make it so that if the button is pressed that a remote event fires
Then inside the server script we’ve a function that connects to this remote event
Because of the nature of remote events we can know which player fired it so we also know which player wants to teleport
Then inside the function we just have to then move the player.character
Which can be done with :move(), but you’re better off changing Character.PrimaryPart.CFrame
I hope with 2 scripts
yes
Else you need to reread my messages
yeah im rereading it
@hazy fern this one right?
** You are now Level 2! **
Sorry for my late reply but yeah, that should work
my friend told me that i gotta create a remote
i tried but its wont fire
Do you’ve your output open?
Hm
add a second parameter inside the WaitForChild which is just 10
Which means it will only yield for a maximum of 10 seconds
@carmine fog you understood that right?
local Players = game:GetService("Players")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local teleportEvent = ReplicatedStorage:WaitForChild("TeleportEvent", 10)
local screenGui = script.Parent:WaitForChild("ScreenGui", 10)
local button = screenGui:WaitForChild("Obby", 10)
local function onButtonClicked()
teleportEvent:FireServer()
end
button.MouseButton1Click:Connect(onButtonClicked)
@hazy fern ?
like this or sum
Yes that should make the script not stackend
it aint teleporting
Any new errors
That stack end isn’t related to either of the scripts right?
And there are no new errors after pressing the button right?
Yes
Does it take more than 10s for the button to be created?
no
its instantly
the button showed up instantly
but after a few sec
these show up
Wait where’s this script located?
in the screengui?
Show me the explorer please
** You are now Level 3! **
Frame 1 is where the button located
Well I now see the issue
🤯
Your script tries to find the screengui inside the screengui
Script.parent is the screengui
OHHHHH
Script.Parent.Screengui = nil
i will add this part to the script?
The button isn’t a direct child of screengui
eh?
Then screengui.obby doesn’t exist
uh
Wait hang on, obby isn’t inside button right?
it inside a frame inside screengui
1 or 2?
1
ScreenGui.Frame1:WaitForChild(“Obby”,10)
ok 2 sec
seem to be another erro
ScreenGui.Frame1:WaitForChild(“Obby”,10) isnt right or sum
nv
nvm
i found out what it meant
I’m on phone so there’s probably an issue with my quotes
Yeah welcome to mobile scripting, it’s a hellhole
Did you move the script?