Why this script don't work?

I try a script to make my team Gui work but it don’t have any idea of why?

The script.

local p=script.Parent.Parent.Parent.Parent.Parent.Name

script.Parent.MouseButton1click:Connect(function()
	game.Players[p].TeamColor.new("New Yeller")
	game.Wokspace[p].Humanoid.Health=0
	script.Parent.Parent.Parent.Enabled=false
end)

I already think that may be because I did get this from youtube it may be a lie if not anobody have an idea?

Does anybody know why its not working?

Well i can tell you that you should changed the humanoid health and the team in a normal script. To change the gui use a local script. Then use a remote event to connect the two.

Local Script:

local plr = game.Players.LocalPlayer
local RemoteEvent = -- Put the path to the remote event here

script.Parent.MouseButton1Click:Connect(function()
	script:FindFirstAncestorWhichIsA('GuiObject').Enabled=false
    RemoteEvent:FireServer()
end)

Server Script:

local RemoteEvent = -- Put the path to the remote event here

RemoteEvent.OnServerEvent:Connect(function(plr)
    plr.TeamColor.new('New Yeller') -- I don't know if this works I just pulled it from your code
    plr.Character.Humanoid.Health = 0
end)

Ok its may be good thx for your help.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.