Hello, i made script using a AI chat and I changed lots of few things but
i get a error if i click the createplaceasync it says
-- arguement 2 missing or nill
-- line 15
the full code
local button = script.Parent -- the button that the player will click
local Players = game:GetService("Players")
local player = Players.LocalPlayer
local p = game.Players.LocalPlayer
local TeleportService = game:GetService("TeleportService")
local newPlace = game:GetService("AssetService")
local placeId = game.PlaceId
button.MouseButton1Click:Connect(function(player)
newPlace:CreatePlaceAsync(placeId)
-- wait for the new place to be created
while not newPlace.IsLoaded do
wait()
end
-- create a text button and set its properties
local textButton = Instance.new("TextButton")
textButton.Name = "Game1"
textButton.Parent = game.CoreGui
textButton.Text = "Teleport to new place"
textButton.Position = UDim2.new(0.5, 0, 0.5, 0)
textButton.Size = UDim2.new(0, 150, 0, 50)
textButton.AnchorPoint = Vector2.new(0.5, 0.5)
-- function to teleport the player to the new place when the text button is clicked
textButton.MouseButton1Click:Connect(function(onTextButtonClicked)
local sendingdata = {}
sendingdata["robux"] = p.leaderstats.Robux.Value
game.Players.LocalPlayer:Teleport(newPlace.PlaceId,player, sendingdata)
end)
-- save the new place
newPlace:SavePlaceAsync(true)
end)
Hope this understands you and please help me I don’t know what
I used local script?
on the newPlace:CreatePlaceAsync() you gotta do this:
place Name, then ID
so basically do CreatePlaceAsync(“Name”,123123123)
1 Like
what id?? coz i dont want template i just wanna show basic or should I???
i did but it gave me error to be a server script
yeah, you gotta do that. I would firea remote event
but i never know how to use remotes??
local button = script.Parent -- the button that the player will click
local Players = game:GetService("Players")
local TeleportService = game:GetService("TeleportService")
local newPlace = game:GetService("AssetService")
local placeId = game.PlaceId
button.MouseButton1Click:Connect(function(player)
newPlace:CreatePlaceAsync("testgame1",placeId)
-- wait for the new place to be created
while not newPlace.IsLoaded do
wait()
end
-- create a text button and set its properties
local textButton = Instance.new("TextButton")
textButton.Name = "Game1"
textButton.Parent = game.CoreGui
textButton.Text = "Teleport to new place"
textButton.Position = UDim2.new(0.5, 0, 0.5, 0)
textButton.Size = UDim2.new(0, 150, 0, 50)
textButton.AnchorPoint = Vector2.new(0.5, 0.5)
-- function to teleport the player to the new place when the text button is clicked
textButton.MouseButton1Click:Connect(function(onTextButtonClicked)
game.Players.LocalPlayer:Teleport(placeId)
end)
-- save the new place
newPlace:SavePlaceAsync(true)
end)
serverscript will work?
it didnt give me any error but the textbutton didn’t show up /:
local textButton = Instance.new("TextButton")
textButton.Name = "Game1"
textButton.Parent = script.Parent.Parent
textButton.Text = "Teleport to new place"
textButton.Position = UDim2.new(0.5, 0, 0.5, 0)
textButton.Size = UDim2.new(0, 150, 0, 50)
textButton.AnchorPoint = Vector2.new(0.5, 0.5)
wait nvm still didn’t work