Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make a teleport or click part for a gui?

So I was making a game about Ice scream 1 and I noticed a bug in my code it wouldnt let me teleport to the map so I need a Ontouch script or a gui that appears when clicked then I need a circus pic I can get from google and you have to press it to teleport heres the code:

local service = game:GetService("TeleportService") local place = 1456361270 ---Map Ice Scream

service:Teleport(place,plr);

2 answers

✓ Accepted answer

#Reminders Just a friendly reminder, that the TeleportService doesn't work in studio for reasons.

Also, try using the little blue button on your editing view to add in LUA code.

#Answers

The thing is, FilteringEnabled forces people to use RemoteEvents and RemoteFunctions. If you don't know what they are, click this: developer.roblox.com/en-us/api-reference/class/RemoteEvent

You can use a touch function to fire a RemoteEvent, and have a LocalScript ready to listen for the RemoteEvent. Take example:

Server Script

local Part = script.Parent
Part.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild('Humanoid') then
		local player = game.Players[hit.Parent]
		game.ReplicatedStorage.RemoteEvent:FireClient(player)
	end
end)

Local Script

game.ReplicatedStorage.RemoteEvent.OnClientEvent:Connect(function()
	print("Your code here!")
end)

Try using this to help with your situation. Feel free to ask me in the comments if I made a typo, if you don't understand anything etc.

Hope I helped! ;)

4 comments

0

Where do I put the scripts??

0

No, it doesn't actually matter. The reason why RemoteEvents were made was because they get passed the Sever-Client barrier. Basically, in the past, you couldn't have a normal script execute something that a local script would do. To get past that, use RemoteEvents. Thanks for asking bud!

0

How does- Nvm ima just watch yt

0

Uh, okay. Best of luck, mate!

I dont understand how scripts work im new to scripting

2 comments

0

Oh, sorry to hear that. To put it simply, there are different sides. One is client (the player) and the Server (the entire server). The server is global, which means that everyone can see it, while client is locally, which means that only the player can see it. Hope that helped.

0

ok

This discussion is preserved as it was. New answers, comments, and votes are closed.