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

How to improve teleporting to a part with UI and Dominus giver and other scripts?

Asked by 3 years ago
Edited 3 years ago

1. So I'm making a teleport to part button on GUI and I want to know how I could improve this LocalScript script.

Here is the code: LocalScript

local btn = script.Parent
local frame = script.Parent.Parent.Frame
local part = game.Workspace.Part
local plr = game.Workspace:WaitForChild("Mrdirtbloc") --my username, so that I can gain the powers

btn.MouseButton1Click:Connect(function()
plr.Position.X = part.Position.X
plr.Position.Z = part.Position.Z
plr.Position.Y = part.Position.Y
end)

I want to, in order to stop exploiters or any annoying people, make the script harder to read.

  1. I'm trying to make a system that makes the player have a free item, on their avatar.

Here is the script, as a script .

local plr = game.Workspace:WaitForChild("Mrdirtbloc") --I want it to affect me and me only
local rStorage = game.ReplicatedStorage
local item = rStorage.Dominus --the item the user gets

wait(1)
item:Clone()
item.Parent = plr
end

3. --Tutorial-- How to make a destroy the player model system

This isn't that hard, and it's great fun to see.

So, inside Workspace , put a new script and open it.

local plrModel = game.Workspace:WaitForChild("--username here")

wait(1)
plrModel:Destroy()

And there we have it! I get asked to do this all the time, so I felt like it would be fun to show off!

But it isn't done... Now destroy the camera!

local cam = game.Workspace.CurrentCamera

wait(1)
cam:Destroy()

To run it all together, we get this in the script.

local plrModel = game.Workspace:WaitForChild("--username here")
local cam = game.Workspace.CurrentCamera

wait(1)
plrModel:Destroy()
cam:Destroy()
end

Thank you!

Answer this question