I am making a game whee when you touch a brick if will open a Gui to ask for conformation to teleport to the shop and it also says Worspace is not a valid member of DataModel
script.Parent.Touched:connect(function(player) local teleportgui = game.Worspace.TeleportGui:Clone() teleportgui .Parent = game:GetService("StarterGui") end)
Problem
I've caught 2 problems in your script. 1. You made a typo. 2. You parented the gui into "StarterGui" which is the gui which every player gets upon joining. 3. You didn't even check if a player touches the brick instead of a normal part.
Solution
Just simply correct the worspace into workspace and try to get the player's PlayerGui
script.Parent.Touched:connect(function(part) -- the part which touched the brick local parent = part.Parent -- the parent of the part local player = game.Players:GetPlayerFromCharacter(parent) -- check if the parent is a player character if player then -- if the player matching the character is found local teleportgui = game.Workspace.TeleportGui:Clone() -- i corrected the workspace for you <3 teleportgui .Parent = player.PlayerGui -- the folder for guis of the player end end)
A tip (not a robux tip lol)
No need for that, but you should make the script check if the player already has the gui which will avoid giving the player multiple guis or you should put a debounce. http://wiki.roblox.com/?title=Debounce
Here is the option with the gui checker:
script.Parent.Touched:connect(function(part) -- the part which touched the brick local parent = part.Parent -- the parent of the part local player = game.Players:GetPlayerFromCharacter(parent) check if the parent is a player character if player then -- if the player matching the character is found if not player.PlayerGui:FindFirstChild("TeleportGui") then -- if the gui is NOT found local teleportgui = game.Workspace.TeleportGui:Clone() -- i corrected the workspace for you <3 teleportgui .Parent = player.PlayerGui -- the folder for guis of the player teleportgui.Name = "TeleportGui" -- change the name, we are gonna search for it end end end)
Comment on this if your script still errors so i'll just check the script again just incase i made a mistake.