I’m currently trying to script a teleport button where if you’re a “Customer” in a group it’ll teleport you, but if you’re a Guest or Trainee+ it’ll make a GUI pop up saying you’re unable to get a job.
The issue is that the script isn’t working, and no errors are coming through the Output. Would anyone know a fix for this?
Script:
local button = script.Parent
local TeleportService = game:GetService("TeleportService")
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local JoinGroup = PlayerGui:WaitForChild("JoinGroup")
local Frame = JoinGroup:WaitForChild("Frame")
local Unable = PlayerGui:WaitForChild("Unable")
local UnableFrame = JoinGroup:WaitForChild("Frame")
local groupId = 7331168
local gameId = 6106602627
button.MouseButton1Click:Connect(function()
if player:GetRankInGroup(groupId) == 1 then
TeleportService:Teleport(gameId)
else
if player:GetRankInGroup(groupId) == 0 then
Frame:TweenPosition(UDim2.new(0.385, 0,0.537, 0), "Out", "Back")
wait(3)
Frame:TweenPosition(UDim2.new(0.385, 0,1, 50), "Out", "Back")
else
if player:GetRankInGroup(groupId) >= 2 then
UnableFrame:TweenPosition(UDim2.new(0.385, 0,0.537, 0), "Out", "Back")
wait(3)
UnableFrame:TweenPosition(UDim2.new(0.385, 0,1, 50), "Out", "Back")
end
end
end
end)
This service does not work during playtesting in Roblox Studio — To test aspects of your game using it, you must publish the game and play it in the Roblox application.
local button = script.Parent
local TeleportService = game:GetService("TeleportService")
local player = game.Players.LocalPlayer
local PlayerGui = player:WaitForChild("PlayerGui")
local JoinGroup = PlayerGui:WaitForChild("JoinGroup")
local Frame = JoinGroup:WaitForChild("Frame")
local Unable = PlayerGui:WaitForChild("Unable")
local UnableFrame = JoinGroup:WaitForChild("Frame")
local groupId = 7331168
local gameId = 6106602627
button.MouseButton1Click:Connect(function()
print("Button pressed")
if player:GetRankInGroup(groupId) == 1 then
print("Customer!")
TeleportService:Teleport(gameId)
elseif player:GetRankInGroup(groupId) == 0 then
print("Guest/Trainee+!")
Frame:TweenPosition(UDim2.new(0.385, 0,0.537, 0), "Out", "Back")
wait(3)
Frame:TweenPosition(UDim2.new(0.385, 0,1, 50), "Out", "Back")
elseif player:GetRankInGroup(groupId) >= 2 then
print("Insert a Better Title Name here!")
UnableFrame:TweenPosition(UDim2.new(0.385, 0,0.537, 0), "Out", "Back")
wait(3)
UnableFrame:TweenPosition(UDim2.new(0.385, 0,1, 50), "Out", "Back")
end
end)
I would have suggested letting OP figure out the problem before you give the answer. If she figures it out manually she will be less likely to run into a similar error in the future. I would come back later @rom8nn and try and fix the problem manually, if you still cannot fix it after an hour or 2 come back to this thread and post a reply.