I updated the post above, which fix the last issue. The Players.PlayerAdded
event was not necessary in this case, because the script depends on a ClickDetector
which a player clicks. They already exist, and the provided argument from the event should be utilized to its maximum extent.
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
game.Players.PlayerAdded:Connect(function(player)
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)
end)
Seems to be unresponsive, not sure why
Hey, it’s also unresponsive, whilst no errors
There are a few possibilities:
- Your script is a
LocalScript
. Apparent from how you handle the sounds to be played. - Script doesn’t work for some other technical issues.
- You missed the other script:
script.Parent.ClickDetector.MouseClick:Connect(function(player)
local MarketplaceService = game:GetService("MarketplaceService")
local Coins = player.leaderstats.Scamollars
local GamepassID = 19552415 -- REPLACE 1234567 WITH YOUR GAMEPASS ID
local sound = game.Workspace.ERROR
if MarketplaceService:UserOwnsGamePassAsync(player.UserID, GamepassID) then
Coins.Value = Coins.Value + 2
sound:Play()
else
Coins.Value = Coins.Value + 1
sound:Play()
end
end)
- Other reasons, probably very unlikely.
What kind of script it is and where is the script?
it’s a server script, inside a part
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
Apologies, mixed up it’s a server script.
Show me the explorer, maybe I will see the issue.
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.
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.
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.