Im trying to make a door, and when you click on the handle it teleports you inside the room
> function onClicked(plr) if plr.Name == "Bylli_Oruze" or plr.Name == script.Parent.Parent.Parent.CurrentOwner.Value then game.Players.LocalPlayer.Character.HumanoidRootPart.CFrame = CFrame.new(script.Parent.Parent.In.Position) end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
"In" is a little part on the other side of the door that represents where the player should be moved to (There is also an "Out" part on the outside of the door for when the player wants to leave the room)
the "If plr.Name" Part is for the house script im trying to make, i put my name as the creator should have access to all the houses no matter what
im not sure where i went wrong
The part is in workspace right?If it is then the script has to be a server script/normal script because localscripts don't work in workspace and a server script can't do game.Players.LocalPlayer but you have the local player through an argument, why don't you use that
after a few lost brain cells and some research i got this:
debounce = false script.Parent.ClickDetector.MouseClick:Connect(function(player) if not debounce then debounce = true local char = player.Character if player.Name == "Bylli_Oruze" or player.Name == script.Parent.Parent.Parent.CurrentOwner.Value then script.Parent.Parent.WoodPart.Open:Play() char.HumanoidRootPart.CFrame = CFrame.new(112.295, 5.67, -97.05) script.Parent.Parent.Parent.Buzzer.Indi.BrickColor = BrickColor.new("Pastel blue-green") wait(2) script.Parent.Parent.Parent.Buzzer.Indi.BrickColor = BrickColor.new("Persimmon") wait(1) debounce = false end end end)
thanks for the help anyway, il accept the answer above