Hi, I know that the title is confusing but I am making a Dealership and I have a button that the text is "Special Vehicles". When you click it, it will ask you for a gamepass or if you have one a script will execute.
It says the error is in line 8 in the Script
This is the error: "12:17:18.683 - Unable to cast Instance to int"
Here is the code for the local script:
local player = game:GetService('Players').LocalPlayer local gui = player:WaitForChild("PlayerGui"):WaitForChild("DealershipGUI") local button = gui:WaitForChild("CategoryContainer").SpecialVeh local hasSpecialPass = game:GetService('ReplicatedStorage'):WaitForChild("hasSpecialGamepass") button.MouseButton1Click:connect(function() hasSpecialPass:FireServer() end)
Here is the code for the script:
local hasSpecialPass = game:GetService('ReplicatedStorage'):WaitForChild("hasSpecialGamepass") local GamepassId = 1186864857 local GamePassService = game:GetService('GamePassService') hasSpecialPass.OnServerEvent:connect(function(player) local gui = player:WaitForChild("PlayerGui"):WaitForChild("DealershipGUI") local button = gui:WaitForChild("CategoryContainer").SpecialVeh if GamePassService:PlayerHasPass(GamepassId, player) then print("hi") end end)
local hasSpecialPass = game:GetService('ReplicatedStorage'):WaitForChild("hasSpecialGamepass") local id = 1186864857 local GamePassService = game:GetService('GamePassService') hasSpecialPass.OnServerEvent:connect(function(player) local gui = player:WaitForChild("PlayerGui"):WaitForChild("DealershipGUI") local button = gui:WaitForChild("CategoryContainer").SpecialVeh if GamePassService:PlayerHasPass(player, id) then print("hi") end end)