01 | script.Parent.MouseButton 1 Click:Connect( function () |
02 | local plr = script.Parent.Parent.Parent.Parent.Parent |
03 | local chr = plr.Character |
04 |
05 | if plr.PlayerOwnsTheMaskPass.Value = = true then |
06 | local newmask = script.Parent.TOKYOGHOULMASK:Clone() |
07 | newmask.Parent = chr |
08 | newmask.Mask.Weld.Part 1 = chr.Head |
09 | script.Parent.Text = "Remove" |
10 | script.Parent.removefunc.Disabled = false |
11 | script.Disabled = true |
12 | else |
13 | script.Parent.Text = "You do not own this gamepass!" |
14 | local market = game:GetService( "MarketplaceService" ) |
15 | local id = 7538706 |
16 | market:PromptGamePassPurchase(plr,id) |
17 | wait( 4 ) |
18 | script.Parent.Text = "Tokyo Ghoul Mask" |
19 | end |
20 | end ) |
I click it and then it works but the console comes out with
Players.LegoUnicornRoblox.PlayerGui.CharacterCreation.GamepassFrame.TokyoMask.r:8: Expected ')' (to close '(' at line 1), got <eof>
and the remove function stops working
01 | script.Parent.MouseButton 1 Click:Connect( function () |
02 | local plr = script.Parent.Parent.Parent.Parent.Parent |
03 | local chr = plr.Character |
04 |
05 | if plr.PlayerOwnsTheMaskPass.Value = = true then |
06 | local newmask = script.Parent.TOKYOGHOULMASK:Clone() |
07 | newmask.Parent = chr |
08 | newmask.Mask.Weld.Part 1 = chr.Head |
09 | script.Parent.Text = "Remove" |
10 | script.Parent.removefunc.Disabled = false |
11 | script.Disabled = true |
12 | else |
13 | script.Parent.Text = "You do not own this gamepass!" |
14 | local market = game:GetService( "MarketplaceService" ) |
15 | local id = 7538706 |
You forgot the parameter Player. Next time when you are making an event even if you don’t use the parameters you should still include them.
Here is your script fixed:
01 | script.Parent.MouseButton 1 Click:Connect( function (player) |
02 | local plr = script.Parent.Parent.Parent.Parent.Parent |
03 | local chr = plr.Character |
04 |
05 | if plr.PlayerOwnsTheMaskPass.Value = = true then |
06 | local newmask = script.Parent.TOKYOGHOULMASK:Clone() |
07 | newmask.Parent = chr |
08 | newmask.Mask.Weld.Part 1 = chr.Head |
09 | script.Parent.Text = "Remove" |
10 | script.Parent.removefunc.Disabled = false |
11 | script.Disabled = true |
12 | else |
13 | script.Parent.Text = "You do not own this gamepass!" |
14 | local market = game:GetService( "MarketplaceService" ) |
15 | local id = 7538706 |
16 | market:PromptGamePassPurchase(plr,id) |
17 | wait( 4 ) |
18 | script.Parent.Text = "Tokyo Ghoul Mask" |
19 | end |
20 | end ) |
You can ask clarification anytime.