I am not a very good scripter at all. I have tried finding a solution online but couldn’t find one.
I have been trying to fix this script however I dosn’t seem to work anymore when it used to. I think it is to do with the Cframe but have been unable to find what else I would need to put there to fix it. I was wondering if any of you knew how to fix this script. Thankyou for reading.
wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
torso = player.Character.Torso
torso.CFrame = game.Workspace.telepart.CFrame
end
end
button.MouseButton1Click:connect(teleport)
while true do wait()
debounce = false
wait(7.5)
end
It is showing a error marker around —> torso = player.Character.Torso
1 Like
torso.CFrame = game.Workspace.telepart.Cframe
Wouldnt it supposed to be like this?
torso.Position = CFrame.new(game.Workspace.telepart.Position)
Also,its not like this.
HRP = player.Character.HumanoidRootPart
HRP.Position = CFrame.new(game.Workspace.telepart.Position)
1 Like
I am not good at script as well but I think you used a R15 roblox character.
R6 character has torso but R15 character got HumonoidRootPart.
I think you fix the script like this
torso = player.Character.Torso or player.Character.HumonoidRootPart
1 Like
From what i remember,both RigTypes have the HumanoidRootPart,also,torso is not the HumanoidRootPart.
1 Like
Would anything change if you made the variables local?
local torso = player.Character.Torso
1 Like
No, but it is always good to put local before variables.
1 Like
Oh yeah,i didnt even noticed that,thank you.
1 Like
Its a local script so I don’t think that would do much but thankyou anyway.
Just a reminder, .Position
takes a Vector3 value, not a CFrame value.
1 Like
The type of script it is doesn’t matter when making variables local. Local variables are variables that only exist in the thread they were made in.
Anyways, what’s the exact error you’re getting?
1 Like
[12:41:00.551 - spawn is not a valid member of Workspace]
12:41:00.552 - Stack Begin
[12:41:00.552 - Script ‘Players.JohnSteffenson.PlayerGui.Menu.Frame.TextButton.LocalScript’, Line 11]
12:41:00.553 - Stack End
That looks like it is from another script. Do you mind screenshotting your whole output?
1 Like
I just did something and it worked. Not perfectly my head is in the brick.
I don’t see the word “spawn” anywhere in the script. Is this the entire script?
Also, try using game.Workspace:WaitForChild(“telepart”) and see what happens.
1 Like
Cleaned because Devforum doesnt let me delete it.
--R6 Solution
--Only works with R6 and will not work with R15
wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
torso = player.Character.Torso
torso.CFrame = game.Workspace.telepart.CFrame
end
end
button.MouseButton1Click:connect(teleport)
while true do wait()
debounce = false
wait(7.5)
end
.
--R15 Solution
--Only works with R15 and will not work with R6
wait(1)
player = game.Players.LocalPlayer
button = script.Parent
local debounce = false
function teleport()
if not debounce then
debounce = true
torso = player.Character.HumanoidRootPart
torso.CFrame = game.Workspace.telepart.CFrame
end
end
button.MouseButton1Click:connect(teleport)
while true do wait()
debounce = false
wait(7.5)
end
Thankyou to all that helped I appreciate all the help and support.
I put it in a model if anyone wants to take a copy:
https://www.roblox.com/library/4810622545/Teleport-GUI-R6-and-R15
By the way, a good practice is to use Connect
with a capital C instead of lowercase c
because that is deprecated.
1 Like
I would recommend adding + CFrame.new(0,10,0)
to prevent your character from being glitched inside the part.
1 Like
R15 characters have lower,and upper torsos,and R6,has only the torso.
R15:
UpperTorso
LowerTorso
R6:
Torso
If you want more information about the RigTypes parts,just insert an Rig at roblox studio/use AlreadyPro’s plugin,and you can see the parts in them.
1 Like
Yes, it does not work with R15 because R15 uses UpperTorso and LowerTorso. If you would like to use R15, we said you can use HumanoidRootPart.
Edit: Did not see Phoenix’s post, apologies.
1 Like