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

The script cannot teleport because value doesn't update?

Asked by 4 years ago

Place teleport script (Script)

while true do
    wait(0.1)
local Part = script.Parent
local CD = Part.ClickDetector
local GameId = script.Parent.Value.Value

CD.MouseClick:connect(function(Player)
    game:GetService('TeleportService'):Teleport(GameId, Player)
end) 
end

So I am trying to use a textbox change the value, and that works. But the script doesn't change it it says: Cannot teleport to a place that doesn't exist (place id 0)

Button script (Local Script)

function thingy()
    print("Loading script")
    local mess2 = game.Workspace.newestad.Part2.SurfaceGui.id
    local l = script.Parent.Parent.TextBox
    print("Changing text 2.")
    mess2.Text = (""..l.Text)
    print("Done.")
game.Workspace.test.Clickable.Value.Value = script.Parent.Parent.TextBox.Text 
end

script.Parent.MouseButton1Click:Connect(thingy)
0
(Almost) All changes that the client makes will not be replicated to the server which means that while the value has changed on the client it has NOT changed on the server. In order for you to do this you will need to use a remote event/function and send that change to the server so that it knows. SynthetickDev 188 — 4y
0
Also you don't have to constantly connect to the MouseClick event for the ClickDetector so you can remove the while loop and the wait :) SynthetickDev 188 — 4y
0
Okay I am gonna try. jamielelystad 20 — 4y

Answer this question