You would use a RemoteEvent to handle the actual teleportation.
LocalScript parented to gui button:
local teleportEvent = game:GetService("ReplicatedStorage"):WaitForChild("TeleportEvent")
script.Parent.MouseButton1Click:Connect(function ()
teleportEvent:FireServer()
end)
Script in SSS or Workspace, either one:
local RS = game:GetService("ReplicatedStorage")
local teleportEvent = Instance.new("RemoteEvent")
local tycoons = workspace.Tycoons
teleportEvent.OnServerEvent:Connect(function (p)
for i, v in pairs(tycoons:GetChildren()) do
if v.Owner.Value == p.Name then
p.Character:SetPrimaryPartCFrame(v.Spawn.CFrame + Vector3.new(0, 4, 0)
break
end
end
end)
You'll have to change a few things. Since you didn't respond to my comments, I assumed that your tycoons were in workspace.Tycoons, that the path to the owner StringValue was tycoon.Owner, and the spawn platform was tycoon.Spawn. You'll have to tweak those, since those names are completely figurative.
3 comments
Sorry if this is non-descriptive, but I cannot find any code or make any code that works.
What is the path to the tycoon kits? Are they parented to the same instance?
Also, what's the path to the StringValue inside the tycoon?