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

Why wont my gamepass gear giver work properly?

Asked by 4 years ago
--In my game,I want to have a gamepass that lets you get a gun by the click of a button. My script doesn't work, however, and lets me get the gun whether I have the gamepass or not. Does anyone see any problems with the script?

repeat wait() until game.Players.LocalPlayer.Character

local Player = game.Players.LocalPlayer
local Character = Player.Character
local UserInputService = game:GetService("UserInputService")
local MarketPlaceService = game:GetService("MarketplaceService")
local IdGamepass = 8238123
local RemoteEvent = game.ReplicatedStorage.GamepassEvent
local HasGamepass = false

RemoteEvent.OnClientEvent:Connect(function(isAllowed)
    if isAllowed then
        HasGamepass = true
    else
        HasGamepass = false
    end
end)

script.Parent.MouseButton1Click:connect(function()
    if HasGamepass = true then
        local tool = script.Parent.HyperlaserGun:Clone()
        tool.Parent = Player.Backpack
    end
end)

wait(1)
RemoteEvent:FireServer(IdGamepass)
0
One error I see is on line 22, make it If HasGamepass == true then . Because you're not setting a bool with one =, if you do == it's doing an if then statement checking if it's true or false if that player owns the gamepass. Might be your error, not sure. killerbrenden 1537 — 4y
0
Would you mind posting the script that fires the server to the client as i think the main bug is in that script, thanks Lord_WitherAlt 206 — 4y

Answer this question