of     1   

Blinfield33
#225971453Wednesday, October 04, 2017 8:07 PM GMT

This script is inside a GUI button. The point is to teleport the player to a random part inside a model in the workspace called "Map" based on the player's team. I don't want to use normal spawnlocations (so when the player dies they go back to the lobby and have to click play again), just blocks labeled 1-8 inside of the model "Team1" or "Team2." I have tried to find the problem but I have no clue whats wrong. Script: local player = script.Parent.Parent.Parent.Parent.Parent --- locate the name of the team local team = script.Parent.Parent.Parent.Parent.Parent.Team --- locate the model with the same name as the team inside the map local s = game.Workspace.Map:FindFirstChild(""..team) --- choose random part (labeled 1-8) in model tspawn = s:GetChildren()[math.random(#model:GetChildren())] --- here on is if player click then player teleported to the random block script.Parent.MouseButton1Click:connect(function() player.Character:MoveTo(tspawn.Position) end end Any Idea whats wrong?
NexanianStudios
#225973011Wednesday, October 04, 2017 8:44 PM GMT

Server scripts don’t run when it’s an ancestor of the player
Blinfield33
#225973857Wednesday, October 04, 2017 9:04 PM GMT

Its not, its a local script.
Giftbots
#225974107Wednesday, October 04, 2017 9:09 PM GMT

local player = script.Parent.Parent.Parent.Parent.Parent --- locate the name of the team local team = script.Parent.Parent.Parent.Parent.Parent.Team --- locate the model with the same name as the team inside the map local s = game.Workspace.Map:FindFirstChild(""..team) --- choose random part (labeled 1-8) in model tspawn = s:GetChildren()[math.random(#model:GetChildren())] --- here on is if player click then player teleported to the random block script.Parent.MouseButton1Click:connect(function() player.Character.HumanoidRootPart.CFrame = CFrame.new(tspawn.Position) end end
Blinfield33
#225974657Wednesday, October 04, 2017 9:21 PM GMT

Oh so I was missing humanoid root and Cframe. Got it. OK I will test it as soon as I can and get back to you on it it works or not. Thanks.
Blinfield33
#225984159Thursday, October 05, 2017 1:12 AM GMT

Still, doesn't work. Maybe its something in defining the team name and converting it into a model to look for? I have no clue.
Blinfield33
#225986552Thursday, October 05, 2017 2:14 AM GMT

Yeah, I think its something that's wrong in the following part. I just don't know what. local player = script.Parent.Parent.Parent.Parent.Parent --- locate the name of the team local team = script.Parent.Parent.Parent.Parent.Parent.Team --- locate the model with the same name as the team inside the map local s = game.Workspace.Map:FindFirstChild(""..team) --- choose random part (labeled 1-8) in model tspawn = s:GetChildren()[math.random(#model:GetChildren())]
freeroblox1234567
#225988765Thursday, October 05, 2017 3:28 AM GMT

local player = game.Players.LocalPlayer local team = player.Team local tspawn if team then local s = game.Workspace.Map:FindFirstChild(""..team.Name) local children = s:GetChildren() tspawn = children[math.random(#children)] end
Blinfield33
#225993032Thursday, October 05, 2017 7:41 AM GMT

The Problem has evolved with that part of the script. So I have created the Correct thread for that at: https://forum.roblox.com/Forum/ShowPost.aspx?PostID=225992971 Now the problem is in the Teleport part. I created this Test with a part in the workspace and the Gui TextButton: script.Parent.MouseButton1Click:connect(function() local part = game.Workspace.Part player.Character.HumanoidRootPart.CFrame = CFrame.new(part.Position) end end) What has happened that is wrong?

    of     1