Script end) syntax error, need help

Maybe move the script to serverscriptservice

Hey!

My script is a server script, it’s located inside a part. Technically, this script should work as it’s made from my other basic script which worked, I now honestly have no clue why it’s not working. I also checked that script, but it hadn’t worked.

I really do appreciate you though, for trying to help me.

make it a normal script instead of local

1 Like

Apologies, mixed up it’s a server script.

Show me the explorer, maybe I will see the issue.

1 Like

it’s inside plenty of grouped models, i dont think that should affect it - if you would like i could invite you over to tc, to figure it out

All of that checks out, but have you considered about if the edits were actually applied or if they were just remained as a draft? Last time I forgot to apply the edits and suddenly the game goes haywire against me. :slight_smile:

1 Like

I don’t believe I even have the drafts feature, it all gets applied - thanks for asking though.

Make a remote event in ReplicatedStorage and name it Clicked. Then, move the script to ServerScriptService and type this code:

game:GetService("ReplicatedStorage"):WaitForChild("Clicker").OnServerEvent:Connect(function(player)
	local MarketPlaceService = game:GetService("MarketplaceService")
	local Coins = player.leaderstats.Scamollars
	local GamepassID = 19552415
	local sound = game.Workspace.ERROR
	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserID, GamepassID) then
        Coins.Value = Coins.Value + 2
        sound:Play()
    else
        Coins.Value = Coins.Value + 1
        sound:Play()
    end
end)

Next make a localscript inside the part and type this code:

script.Parent:WaitForChild("ClickDetector").MouseClick:Connect(function(player)
    game:GetService("ReplicatedStorage"):WaitForChild("Clicked"):FireServer(player)
end)

If this does not work show me the error.

1 Like

image

Show me the explorer please. I dont understand the error lol

Sorry apologies, it was inside a serverscript, I changed it and now there’s no errors but unresponsive now. Can you come to team create?

Try my newest script.
I’m almost 100% sure It will work.

Yeah, I can do team create. Send the game over.

https://developer.roblox.com/en-us/api-reference/class/LocalScript

updated post with download link

yes i know, scroll above thanks though

Found the solution, thank you to everyone who replied to me.

New code

script.Parent.ClickDetector.MouseClick:Connect(function(PlayerWhoClicked)
local MarketPlaceService = game:GetService(“MarketplaceService”)
local Coins = PlayerWhoClicked.leaderstats.Scamollars
local GamepassID = 19552415 – REPLACE 1234567 WITH YOUR GAMEPASS ID
local sound = game.Workspace.ERROR

	if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(PlayerWhoClicked.UserId, GamepassID) then
		Coins.Value = Coins.Value + 2
		sound:Play()
	else
		Coins.Value = Coins.Value + 1
		sound:Play()
	end

end)