#Teleport works the first time, but then stops working after first usage

1 messages · Page 1 of 1 (latest)

wanton hound
#

SCRIPT THAT TELEPORTS PLAYER AND DOES TRANSITION:

local rs = game:GetService("ReplicatedStorage")
local re = rs.TaxiService
local ts = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local tweenInfo2 = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.In,0,false,0)
local goal = {Transparency = 0}
local goal2 = {Transparency = 1}

re.OnServerEvent:Connect(function(plr,location)
    print("Fired!")
    local char = plr.Character
    local hrp = char.HumanoidRootPart
    local plrgui = plr.PlayerGui
    local taxiServiceGui = plrgui.TaxiService
    local tpPoint = game.Workspace.TaxiService:FindFirstChild(location).TaxiTPPoint
    taxiServiceGui.BlackFrame.Visible = true
    local tween1 = ts:Create(taxiServiceGui.BlackFrame,tweenInfo,goal)
    tween1:Play()
    tween1.Completed:Connect(function()
        hrp.CFrame = tpPoint.CFrame
        task.wait(0.5)
        print("Fired!")
        local tween2 = ts:Create(taxiServiceGui.BlackFrame,tweenInfo2,goal2)
        tween2:Play()
        tween2.Completed:Connect(function()
            taxiServiceGui.BlackFrame.Visible = false
        end)
    end)
end)

SCRIPT THAT FIRES THE TELEPORTATION AND MAKES THE FRAME INVISIBLE:

local button = script.Parent
local location = button.Text
local rs = game:GetService("ReplicatedStorage")
local re = rs.TaxiService
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer

button.MouseButton1Click:Connect(function()
    re:FireServer(location)
    plr.PlayerGui.TaxiService.TaxiService.Visible = false
end)
#

I have no clue how to fix this it's incredibly confusing to me

#

There's also a script for adding the buttons to the scrolling frame, I'm not sure if that has any effect on it but I'll send it in anyways

thick estuaryBOT
#

studio** You are now Level 7! **studio

wanton hound
#
local frame = script.Parent
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local char = plr.Character
local rs = game:GetService("ReplicatedStorage")
local location = rs.Location

frame.Changed:Connect(function()
    if frame.Fired.Value == true then
        frame.Fired.Value = false
        if frame.Visible == true then
            local count = 0
            local pos = 0
            for i, v in pairs (workspace.TaxiService:GetChildren()) do
                if not (v.Name == char.Checks.Location.Value) then
                    local xscale = 0
                    local yscale = 0
                    local temp = location:Clone()
                    temp.Text = v.Name
                    if count < 0 then 
                        if math.fmod(count, 2) == 1 then
                            x = 0.525
                        else
                            x = 0
                        end
                    end
                    if pos < 0 then
                        if math.fmod(pos, 2) == 1 then
                            y = 0.01
                        else
                            y = 0.08
                        end
                    end
                    temp.Parent = plr.PlayerGui.TaxiService.TaxiService.ScrollingFrame
                    count = count + 1
                    if math.fmod(count, 2) == 0 then
                        pos = pos + 1
                    end
                end

            end
        end
    end
end)

frame.Changed:Connect(function()
    if frame.Visible == false then
        for i, v in pairs(plr.PlayerGui.TaxiService.TaxiService.ScrollingFrame:GetChildren()) do
            v:Destroy()
        end
    end
end)
stiff bloom
#

im honestly confused aswell but imma try and help u

stiff bloom
# wanton hound SCRIPT THAT TELEPORTS PLAYER AND DOES TRANSITION: ```lua local rs = game:GetServ...

local button = script.Parent
local location = button.Text
local rs = game:GetService("ReplicatedStorage")
local re = rs.TaxiService
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer

button.MouseButton1Click:Connect(function()
re:FireServer(location)
plr.PlayerGui.TaxiService.TaxiService.Visible = false

plr.PlayerGui.TaxiService.Fired.Value = true -- ADDED: Reset Fired to regenerate UI

end)
the teleport and frame thingy

thick estuaryBOT
#

studio** You are now Level 6! **studio

idle jolt
#

if they didnt code it u shouldnt help them

stiff bloom
idle jolt
#

cuz waste of time

wanton hound
idle jolt
#

k

#

ok

#

mb

stiff bloom
wanton hound
#

thanks for the help btw @stiff bloom ill try it out now

idle jolt
stiff bloom
idle jolt
#

pretty much

stiff bloom
#

loser

idle jolt
#

u know those ppl who get code from chatgpt and never put in the time or effort to learning coding

thick estuaryBOT
#

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

idle jolt
#

it's not like theyre gonna become anything

#

or make anything good

#

theyre just wasting their time and urs as well

stiff bloom
#

ok that doesnt matter?

#

even if hes using chatgpt hes still making a game

#

there is plenty people who make things with 0 experience and actually become successful

wanton hound
#

Nah didn't work

stiff bloom
#

im not finished

wanton hound
#

Oh

stiff bloom
#

still working on the other scripts

wanton hound
#

Np

#

I've been working around it for a while but I can't figure out what's causing .visible to stay false

idle jolt
#

make sure to disconnect this or put :Once iinstead of connect, unless the thing ur tweening ends up getting destroyed before the next time that remote event fires

stiff bloom
#

local frame = script.Parent
local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer
local char = plr.Character or plr.CharacterAdded:Wait()
local rs = game:GetService("ReplicatedStorage")
local location = rs.Location

frame.Changed:Connect(function()
if frame.Fired.Value == true then
frame.Fired.Value = false
if frame.Visible == true then
local count = 0
local pos = 0
for i, v in pairs (workspace.TaxiService:GetChildren()) do
if not (v.Name == char.Checks.Location.Value) then
local xscale = 0
local yscale = 0
local temp = location:Clone()
temp.Text = v.Name

                if math.fmod(count, 2) == 0 then 
                    xscale = 0
                else
                    xscale = 0.525
                end

                yscale = 0.01 + 0.08 * math.floor(count / 2) 

                temp.Position = UDim2.new(xscale, 0, yscale, 0) 
                temp.Parent = plr.PlayerGui.TaxiService.TaxiService.ScrollingFrame

                count = count + 1
                if math.fmod(count, 2) == 0 then
                    pos = pos + 1
                end
            end
        end
    end
end

end)

frame.Changed:Connect(function()
if frame.Visible == false then
for i, v in pairs(plr.PlayerGui.TaxiService.TaxiService.ScrollingFrame:GetChildren()) do
if v:IsA("GuiButton") then
v:Destroy()
end
end
end
end)

#

thats the third script

wanton hound
idle jolt
#

u shouuld send screenshots of code theyre way easier to read

#

like this

wanton hound
#

I can do that now if you'd like I usually just send text so people can copy and paste it

open musk
idle jolt
#

bruh horrible code editor font and theme i cant read that

open musk
#

anyway

idle jolt
#
  • light mode
stiff bloom
wanton hound
stiff bloom
#

yeah

wanton hound
#

I had no idea bro what

idle jolt
#

this code is so clumped together

#

also u shouldnt do gui on the server

open musk
#

these problems are usually caused by making the frame visible on the server then invisible on the client, so when the server goes to make it visible again it thinks its still visible from before so nothing happens

wanton hound
#

Yeah that's probably the problem

#

I'll fix it up real quick

stiff bloom
idle jolt
#

it's also gonna be buggy if u have multiple ppl playing i think

#

the way u coded it

stiff bloom
#

no

idle jolt
#

the first time this code runs,

stiff bloom
#

it would be buggy if multiple people use it at once

idle jolt
#

thise event listener is made

#

everytime .completed fires it's gonna be on the server

#

so

#

wait nvm

open musk
idle jolt
#

ok look

#

nvm

#

remote fires for plr1, tween.completed listener is made, tween completes, no problem

remote fires for plr2, tween.completed listener is made, tween completes, yes problem because .completed will run twice, it will tp plr2 and plr1

wanton hound
idle jolt
#

u should rly be doing literally all of this on the client

stiff bloom
#

my font

idle jolt
#

literallty everything ur doing on the server is supposed to be done on client

idle jolt
#

his is the one i use

wanton hound
stiff bloom
#

bro your using the unity default font

wanton hound
idle jolt
#

player movement on client replicates to server (whatever that means)

wanton hound
#

@idle jolt @stiff bloom @open musk thanks for all the help guys really appreciate it 🙏

idle jolt
#

holy glaze

thick estuaryBOT
#

studio** You are now Level 4! **studio

wanton hound
#

Got it from here I think