So basically i'm trying to make a Black screen pop up, and teleport the player to another place after a sound plays. So far, the sounds working, but the GUI isn't (and i'm pretty sure the place teleporter isn't either). What's wrong with this script?

Dialog=script.Parent
Dialog.DialogChoiceSelected:connect(function(Player, Choice)
if Choice == Dialog.DialogChoice1.DialogChoice2.DialogChoice3.DialogChoice4.DialogChoice5.DialogChoice6.DialogChoice7.DialogChoice8.DialogChoice9.DialogChoice10.DialogChoice11.DialogChoice12.DialogChoice13.DialogChoice14 then
	workspace.floweydistorted:Pause()
	workspace.Chef.Head.Decal.Texture = "rbxgameasset://Images/scaryfaceforgame"
	wait(1)
	workspace.floweylaugh:Play()
	local s = Instance.new("ScreenGui",game.Player.PlayerGui)
	local f = Instance.new("Frame",game.Player.PlayerGui.ScreenGui)
	f.Position = UDim2.new(0.003, 0,-0.002, 0)
	f.Size = UDim2.new(0.997, 0,1.024, 0)
	f.BackgroundColor3 = Color3.fromRGB(0,0, 0)
	wait(1)
	local Dialog = script.Parent
local placeid = 376013578
local spawnName = "meme"
local TeleportService = game:GetService("TeleportService") 
Dialog = script.Parent
Dialog.DialogChoiceSelected:connect(function(Player, Choice)
	TeleportService:Teleport(placeid, Player)
end)
end
end)

I also tried using Local Player and putting it in a local script, but that didn't work either. How would this run in a normal script. (If it helps, in the output it said "Player is not a valid member of DataModel")

2 comments

0

On which line is this error thrown?

1

Line 8 and 9 - you are trying to index 'game.Player' - which does not exist. Instead, just use 'Player'. Also make sure to name your GUIs uniquely so that they do not get mixed up.