Hello , im trying to make a button that will teleport you to a certain gameid (value)
the problem is that when the button is pressed it wont work and no print outputs? .
here is the local script for the button
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportEvent = ReplicatedStorage:WaitForChild("Teleport")
local gameid = script.Parent.Parent.Parent.Gameid.Value
local function id()
print("Pressed")
print(gameid)
TeleportEvent:FireServer(gameid)
end
script.Parent.MouseButton1Click:Connect(id)
as you can see that i have a remote event called teleport
this is the serverscriptservice side
local TeleportService = game:GetService("TeleportService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local TeleportEvent = ReplicatedStorage:WaitForChild("Teleport")
TeleportEvent.OnServerEvent:Connect(function(placeId,player)
TeleportService:Teleport(placeId, player)
print("player teleported to"..placeId )
end)
Thanks in advance .