Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 4 years ago

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

Log in to vote
0
Answered by 4 years ago

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! ;)

0
Where do I put the scripts?? SantaD0ggie 2 — 4y
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! Sensei_Developer 298 — 4y
0
How does- Nvm ima just watch yt SantaD0ggie 2 — 4y
0
Uh, okay. Best of luck, mate! Sensei_Developer 298 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

I dont understand how scripts work im new to scripting

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. Sensei_Developer 298 — 4y
0
ok SantaD0ggie 2 — 4y

Answer this question