Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

How can I fix this script?

Asked by 9 years ago

I'm having problems with this script, Idk if im suppose to add a team and add the team color or what but I really need help please respond.

local plr = script.Parent.Parent.Parent.Parent.Parent.Parent -- Ascends the heirarchy and assigns a local variable to the player owning this GUI

script.Parent.MouseButton1Click:connect(function() -- Activates when the GUI is clicked without the mouse leaving the button
    if plr:IsInGroup(755417) then -- Checks if the player is in UAF - Group ID is 80738
        plr.TeamColor = game.Teams["Dark Assault Forces"].TeamColor -- If so, their Team colour is changed to the UAF Team colour
        local char = plr.Character.Humanoid -- Assigns a local variable to the players characters Humanoid
        if char then -- Checks if the character exists
            char.Health = 0 -- Sets the humanoid health to 0 (Kills them)
        end
    end
end)

I tried it and all it does is not change my team here's the order: http://prntscr.com/8q107o

0
You probably need to create a team called "Dark Assault Forces" Programmix 285 — 9y
0
try using plr:GetMouse()..... if im correct MouseButton1Click doesnt work. It should be mouse.Button1Click koolkid8099 705 — 9y
0
@kollkid8099 MouseButton1Click works fine User#9949 0 — 9y
0
It needs to be MouseButton1Down. NeonicPlasma 181 — 9y
View all comments (2 more)
0
You can't click a ScreenGui, you can only click a TextButton, ImageButton, anything else classified as a button. Azmidium 388 — 9y
1
Instead of trying to click the ScreenGui, try this: script.Parent.Frame.Frame.DAF.MouseButton1Click I am not sure what you are trying to accomplish here. LetThereBeCode 360 — 9y

Answer this question