the error i'm getting is:
Unable to cast value to Objects
Stack Begin
Script 'Players.madguy123456788.VIPSGui.Frame.TextButton.Script', Line 7
Stack End
This Is The Script It's Referencing:
script.Parent.MouseButton1Click:connect(function()
local codes = workspace.VIP.Configuration:FindFirstChild(script.Parent.Parent.TextBox.Text .. " VIP")
local plr = script.Parent.Parent.Parent.Parent.Parent.Name
local playr = game.Players:FindFirstChild(plr)
if codes == nil then
local vipc = game:GetService("DataStoreService"):GetDataStore("VIPServers"):GetAsync(script.Parent.Parent.TextBox.Text .. "'s Server")
game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId, vipc, playr)
else
local vipc = codes.Value
game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId, vipc, playr)
end
end)
I'm trying to make a part that when you step on it it saves a VIP Server id to the DataStorage that you can join by typing the player name on a gui
the script to save the Server Is:
local data = game:GetService("DataStoreService")
local vipstore = data:GetDataStore("VIPServers")
script.Parent.Touched:connect(function(part)
if part.Parent:FindFirstChild("Humanoid") then
local plr = part.Parent.Name
if game.Players:FindFirstChild(plr) then
local check = vipstore:GetAsync(plr .. "'s Server")
if type(check) ~= "string" then
script.Parent.Parent.Name = "Creating Server.."
local vip = game:GetService("TeleportService"):ReserveServer(game.PlaceId)
local int = Instance.new("StringValue", workspace.VIP.Configuration)
vipstore:SetAsync(plr .. "'s Server", vip)
int.Name = plr .. " VIP"
int.Value = vip
local plar = game.Players.LocalPlayer
script.Parent.Parent.Name = "Teleporting You.."
game:GetService("TeleportService"):TeleportToPrivateServer(game.PlaceId, vip, plar)
else
script.Parent.Parent.Name = "You Already Have A Server, Type Your Name In Join To Join It"
wait(5)
script.Parent.Parent.Name = "Touch To Get Your Own VIP Server"
end
end
end
end)
Can Anyone Help?

4 comments
thanks :)
Would you mind accepting the answer?
sorry im new to this site, how do i do that
There will be a button on this answer that allows you to do that.