kaviconner
(Kavi Conner)
November 28, 2021, 8:47pm
1
Ok… So the team only spawn works if the Spawn is set to Neutral. But if Neutral = false then the player just spawns somewhere where theres no spawn.
Local Script
local TeamsFrame = script.Parent.Parent.Parent.Parent.TeamsFrame
local PlayerGUIYes = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("PlayerGUIYes")
local Frameformore = script.Parent.Parent.Parent.Parent.Parent.PlayerGUIYes.Frameformore
local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
script.Parent.MouseButton1Click:Connect(function()
game.Players[player].TeamColor = BrickColor.new("Bright green")
game.Workspace[player].Humanoid.Health = 0
-- Tween
Frameformore:TweenPosition(
UDim2.new(0.755, 0, 0.911, 0),
"In",
"Back",
1,
false
)
TeamsFrame:TweenPosition(
UDim2.new(-0.450, 0, -0.187, 0),
"In",
"Back",
1,
false
)
end)
Katrist
(Katrist)
November 28, 2021, 8:52pm
2
Can you show me the spawn properties?
Also, the problem might be because the teamcolor change only replicates locally and not to the server, which means that the server wont let the player spawn there.
kaviconner
(Kavi Conner)
November 28, 2021, 8:59pm
4
Yup! I don’t know how to make it so that the server knows where spawn the player.
I’m going to look it up.
Just change the LocalScript to a ServerScript, and change that script to this:
local TeamsFrame = script.Parent.Parent.Parent.Parent.TeamsFrame
local PlayerGUIYes = script.Parent.Parent.Parent.Parent.Parent:WaitForChild("PlayerGUIYes")
local Frameformore = script.Parent.Parent.Parent.Parent.Parent.PlayerGUIYes.Frameformore
local player = script.Parent.Parent.Parent.Parent.Parent.Parent.Name
script.Parent.MouseButton1Click:Connect(function()
local TweenOnClient = Instance.new("RemoteEvent")
TweenOnClient.Name = "TweenEvent"
TweenOnClient.Parent = script:WaitForChild("LocalScript")
TweenOnClient:FireClient(player)
TweenOnClient:Destroy()
game.Players[player].TeamColor = BrickColor.new("Bright green")
game.Workspace[player].Humanoid.Health = 0
end)
Place a LocalScript named “LocalScript” inside of the above script:
script.ChildAdded:Connect(function(Child)
if Child:IsA("RemoteEvent") then
if Child.Name == "TweenEvent" then
local Connection
Connection = Child.OnClientEvent:Connect(function()
local TeamsFrame = script.Parent.Parent.Parent.Parent.Parent.TeamsFrame
local PlayerGUIYes = script.Parent.Parent.Parent.Parent.Parent.Parent:WaitForChild("PlayerGUIYes")
local Frameformore = script.Parent.Parent.Parent.Parent.Parent.Parent.PlayerGUIYes.Frameformore
-- Tween
Frameformore:TweenPosition(
UDim2.new(0.755, 0, 0.911, 0),
"In",
"Back",
1,
false
)
TeamsFrame:TweenPosition(
UDim2.new(-0.450, 0, -0.187, 0),
"In",
"Back",
1,
false
)
Connection:Disconnect()
end)
end
end
end)
Note: I’m sure there are better ways, but I’m kinda in a rush right now; I’m not even sure if this will work.
1 Like
Forummer
(Forummer)
November 29, 2021, 6:39am
6
local Player = script:FindFirstAncestorWhichIsA("Player")
local Character = Player.Character or Player.CharacterAdded:Wait()
local PlayerGui = Player:WaitForChild("PlayerGui")
local PlayerGUIYes = PlayerGui:FindFirstDescendant("PlayerGUIYes")
local Frameformore = PlayerGUIYes:FindFirstChild("Frameformore")
local TeamsFrame = PlayerGui:FindFirstDescendant("TeamsFrame")
local Button = script.Parent
Button.MouseButton1Click:Connect(function()
Player.TeamColor = BrickColor.new("Bright green")
Character:BreakJoints()
Frameformore:TweenPosition(
UDim2.new(0.755, 0, 0.911, 0),
"In",
"Back",
1,
false
)
TeamsFrame:TweenPosition(
UDim2.new(-0.450, 0, -0.187, 0),
"In",
"Back",
1,
false
)
end)
Possibly this although the original references are incredibly awkward.