the title isnt really what it sounds like
hey developers, i have been working on a project where you can change your team with a textbutton
, then when you press play, it kills you, then i hoped it would of respawned you at the selected teams location.
textbutton code:
--local script
script.Parent.MouseEnter:Connect(function()
script.Parent.Font = Enum.Font.SourceSans
script.Parent:TweenSize(UDim2.new(0, 265,0, 60), 'InOut', 'Sine', .3, true)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.Font = Enum.Font.SourceSansLight
script.Parent:TweenSize(UDim2.new(0, 265,0, 50), 'InOut', 'Sine', .3, true)
end)
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild('Humanoid')
if player.TeamColor == BrickColor.new('Really black') then
script.Parent.TextLabel.Text = 'Please select a team to play!'
wait(2)
script.Parent.TextLabel.Text = 'Hop on into the gameplay!'
else
humanoid.Health = humanoid.Health - humanoid.MaxHealth
script.Parent.TextLabel.Text = 'Preparing your gameplay..'
wait(3)
script.Parent.Parent.Parent.HFrame:TweenPosition(UDim2.new(0,0,0,0), 'InOut', 'Sine', .6)
wait(1)
script.Parent.Parent.Visible = false
wait(1)
script.Parent.Parent.Parent.HFrame:TweenPosition(UDim2.new(0,0,1,0), 'InOut', 'Sine', .6)
end
end)
change team script:
--local script
script.Parent.MouseEnter:Connect(function()
script.Parent.Font = Enum.Font.SourceSans
script.Parent:TweenSize(UDim2.new(0, 265,0, 60), 'InOut', 'Sine', .3, true)
end)
script.Parent.MouseLeave:Connect(function()
script.Parent.Font = Enum.Font.SourceSansLight
script.Parent:TweenSize(UDim2.new(0, 265,0, 50), 'InOut', 'Sine', .3, true)
end)
script.Parent.MouseButton1Click:Connect(function()
local player = game.Players.LocalPlayer
local char = player.Character or player.CharacterAdded:Wait()
local humanoid = char:WaitForChild('Humanoid')
player.TeamColor = BrickColor.Black()
end)
i’ve tried respawnlocation
, nothing seemed to work.
any suggestions, tips or help would be greatly appreciated,
thanks in advance