Hello! In my game I have a problem that someone has a multiplier gamepass everyone in the server gets that multiplier. I tried to get the player that owns the tycoon to check if that player has a gamepads but it still does not work. Please Help!
Here is the script.
local ThreeCash = 10988040 --Times Three Cash
local TwoCash = 10970337 --Time Two Cash
local Players = game:GetService("Players")--Service To Players
local player = game.Players.LocalPlayer--Getting Local Player
local MarketplaceService = game:GetService("MarketplaceService")--Getting MarketplaceService
local Owner = script.Parent.Owner.Value
game.Players.PlayerAdded:Connect(function(player)--Getting Player by function
local success, message = pcall(function()
CashThree = MarketplaceService:UserOwnsGamePassAsync(player.UserId, ThreeCash)
CashTwo = MarketplaceService:UserOwnsGamePassAsync(player.UserId, TwoCash)
end)
end)
if script.Parent.Owner.Value == player then
--Part that get processed
for i,v in pairs(script.Parent.Essentials:GetChildren()) do
if v.Name == "PartCollector" then
v.Touched:connect(function(Part)
if Part:FindFirstChild('Cash') then
if CashThree == true and CashTwo == true then
Money.Value = Money.Value + Part.Cash.Value * 5
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X5")
Debris:AddItem(Part,0.1)
elseif CashThree == true then
Money.Value = Money.Value + Part.Cash.Value * 3
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X3")
Debris:AddItem(Part,0.1)
elseif CashTwo == true then
Money.Value = Money.Value + Part.Cash.Value * 2
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X2")
Debris:AddItem(Part,0.1)
else
Money.Value = Money.Value + Part.Cash.Value
Debris:AddItem(Part,0.1)
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X0")
end
--end
end
end)
end
end
end
local Players = game:GetService("Players")--Service To Players
local MarketplaceService = game:GetService("MarketplaceService")--Getting MarketplaceService
local ObjValue = script.Parent.Owner.Value
local MyPlayer = Players.LocalPlayer
game.Players.PlayerAdded:Connect(function(player)--Getting Player by function
local X3Cash = MarketplaceService:UserOwnsGamePassAsync(player.UserId, 10988040)
local X2Cash = MarketplaceService:UserOwnsGamePassAsync(player.UserId, 10970337)
Multiplier = player.CashMulti.Value
local success, errormessage = pcall(function()
if X3Cash and X2Cash then
Multiplier = 3
elseif X3Cash then
Multiplier = 2
elseif X2Cash then
Multiplier = 1
else
print("Player Does Not Have A Multi Gamepass")
end
end)
if success then
print("GP")
else
print("No GP")
end
end)
--Part that get processed
for i,v in pairs(script.Parent.Essentials:GetChildren()) do
if v.Name == "PartCollector" then
v.Touched:connect(function(Part)
if Part:FindFirstChild('Cash') then
if Multiplier == 3 and MyPlayer == ObjValue then
Money.Value = Money.Value + Part.Cash.Value * 5
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X5")
Debris:AddItem(Part,0.1)
print("Player Owns X5")
elseif Multiplier == 2 and MyPlayer == ObjValue then
Money.Value = Money.Value + Part.Cash.Value * 3
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X3")
Debris:AddItem(Part,0.1)
print("Player Owns X2")
elseif Multiplier == 1 and MyPlayer == ObjValue then
Money.Value = Money.Value + Part.Cash.Value * 2
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X2")
Debris:AddItem(Part,0.1)
print("Player Owns X2")
else
print("Player Does Not Own A Multi Gamepass")
Money.Value = Money.Value + Part.Cash.Value
Debris:AddItem(Part,0.1)
script.Parent.Essentials.MultiplierDisplay.Display.GUI.Amount.Text = ("X0")
end
end
end)
end
end
Did you get this from a yt tutorial? If not, rewrite the script. I know it sounds dumb but I do that with broken scripts and they work after. It is just little errors you do not realise.