Help with teleport/kick dialog

No errors in output

kick script

function check(Player,DialogChoice,Kick)
	if DialogChoice.Name == "???" then
		wait(5)
		Player:Kick("???")
	end
end

script.Parent.DialogChoiceSelected:connect(check)

teleport script

function check(Player,DialogChoice)
	if DialogChoice.Name == "!!!" then
		game:GetService("TeleportService"):Teleport(12437769063,Player)
	end
end

script.Parent.DialogChoiceSelected:connect(check)

image

3 Likes

I might be wrong but doesn’t that event only fire on local scripts?

First off because it’s a normal script the dialogue choice event will never fire so you would need to make it a local script or change the run context

Next you would need to make a remote event and once the dialogue event fires. Fire to the server that a player wants to teleport

Then receive the request and teleport the player to the other game

Whats wrong now??? no errors

image

--teleport
DialogChoice = workspace["Horror Movie Reject "].Dialog["!!!"]
Player = game:GetService("Players").LocalPlayer

if DialogChoice.Name == "!!!" then
	game:GetService("TeleportService"):Teleport(12437769063,Player)
	end
--kick
DialogChoice = workspace["Horror Movie Reject "].Dialog["???"]
Player = game:GetService("Players").LocalPlayer

if DialogChoice.Name == "???" then
	wait(5)
	Player:Kick("???")
	end

Local scripts do not run in that location. Try using the server script but changing the run context to client on the script?

what do you mean by “Local scripts do not run in that location”???

local scripts dont run in workspace, i think he meant

Local scripts only run when they are in one of these places:

  • PlayerGui
  • ReplicatedFirst
  • Tools
  • Characters

Server scripts run in:

  • Workspace
  • ServerScriptService
  • PlayerGui

Extra: Module scripts run when a script calls require() on it. The function returns what the module returns when it runs.

This is as far as I can remember, there are probably a few more places for each.

To fix the problem, you need this local script to be in a valid location, such as the character. It can be automatically placed in the character if you put the script in StarterPlayer.StarterCharacterScripts. If you do this, you also have to keep in mind that the local script will rerun when the player is respawned.

You can also put it in StarterGui so it goes in PlayerGui, but it will also be rerun when the player is respawned, unless placed in a ScreenGui with ResetOnSpawn set to false. This is what I recommend doing, because you most likely have UI in your game.

After relocating the script, you need to adjust the code so it can work again.

1 Like

hell no roblox scripting is so bad :skull: :skull: :skull: :skull: i dont want to spend more 5 hours to make something simple like teleport to other game, i hate when there is no errors in output i dont know what to do

1 Like

image
why does it say error 500 when i try to press “solution”
image