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)
What is the code you are using within the module?
Can you try replacing the parameters received in the module to … and printing out the result?
MODULE.Function = function(...)
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.
This is the code in the script in the door:
This is the LocalScript in StarterGui:
if plr.leaderstats.Money.Value >= part.Value.Value then -- We have an intvalue in the part btw
part.Transparency = 0.5
part.CanCollide = false
the plr parameter is not passed when you call the player, so it should just be
This means you have to redefine the plr variable, which you can easily do at the top of the script with
local plr = game.Players.LocalPlayer
Also, i recommend adding a slight delay before calling the remote event, so the player has time to load
Error: FireClient: player argument must be a Player object
You adjusted the wrong one
when you should have edited
If the RemoteEvent is from LocalScript to Script what should i do since i can’t get LocalPlayer from a script.
Can you quickly send the server side script that receives the function call? (The :Connect(function() part of it)
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:
Your answer is already in there!
when it is the client calling the server, the player variable is passed on. However, it isn’t when the server calls the client
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:
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.