So i'm making a teleport gui but, when i click the button to teleport, i get this error;
Players.Entity_246.PlayerGui.TP.Frame.LocalScript:6: attempt to index field 'Character' (a nil value)
my script is;
local target = script.Parent.Target.Text plr = game:GetService("Players").LocalPlayer char = plr.Character script.Parent.Fire.MouseButton1Click:Connect(function(Tele) char.HumanoidRootPart.Position = game.Players,target.Character.HumanoidRootPart.Position end)
i already have a script setting a string value to the target.
Extra: This is for Void Script Builder Place One and for my own personal learning.
thanks,
local target = script.Parent.Target.Text plr = game:GetService("Players").LocalPlayer char = plr.Character script.Parent.Fire.MouseButton1Click:Connect(function() char.HumanoidRootPart.CFrame = game:GetService("Players")[target].Character.HumanoidRootPart.CFrame end)
you have to use brackets in order to find someone's character from text in a gui. also using position ONLY teleports the humanoidrootpart, leaving the rest of your character in the same position. use cframe instead.