I am trying to pass variables through RemoteEvent or ModuleScript parameters. But whenever i use the variables in the other script i will get errors like “leaderstats is not a valid member of Workspace.Part” even though i am using the plr variable and not the part variable. I tried changing from putting the parameters in the connect function to a normal function but that did no difference.
local module = require(game.ReplicatedStorage.Modules.Doors)
game.Players.PlayerAdded:Connect(function(plr)
module.Function(plr, script.Parent)
end)
I tried that and it said “server”. I then realized it wouldn’t work with a modulescript so i changed it to a remote event OnClient. And maybe i should have clarified that i’m trying to make a door get 0.5 transparency and CanCollide of if the player has a certain amount of money when joining the game.
game.ReplicatedStorage.Remotes.Money.MoneyNeededEvent.OnClientEvent:Connect(function(plr, part)
if plr.leaderstats.Money.Value >= part.Value.Value then -- We have an intvalue in the part btw
part.Transparency = 0.5
part.CanCollide = false
end
end)
This is another script because i am not doing the same thing right now but it’s the same problem just the other way. I am trying to make a trail equip when a button is clicked:
It still doesn’t work. If i print(typeof(plr), plr) and print(typeof(item), item) it says both are the player. Here is the FireServer in the localscript btw: