I am trying to make it so when a player clicks a button a value changes
but i am still stuck requiring this module scripts on the client but they dont work and yes i have researched
here is a sample of the error
20:05:51.577 - Stack Begin
20:05:51.578 - Script 'Players.FerbZides.PlayerGui.Trail.Choose.Green.LocalScript', Line 1
20:05:51.579 - Stack End
i don’t know why this is an issue for requiring module script on the client but i want to hear a fix on it
Code that requires it
local Module = require(game.ServerStorage:FindFirstChild("Lol"))
local plr = game.Players.LocalPlayer
script.Parent.MouseButton1Click:Connect(function()
Module:GetTrailColorLol(plr,plr.TrailColor,8)
end)
Module Script If you need it
local Tba = {}
function Tba:GetTrailColorLol(plr, NumberValue, number) -- number is uhhh idk
if plr then
if NumberValue and number then
NumberValue = number
return NumberValue
end
end
end
return Tba
Try to store the ModuleScript in ReplicatedStorage, because LocalPlayer (client) can’t see into ServerScriptService. I hope this will solve your problem.
20:32:11.916 - Value is not a valid member of Player
20:32:11.918 - Stack Begin
20:32:11.919 - Script 'ServerScriptService.Receive', Line 4
20:32:11.920 - Stack End
why is value not a valid member of player but it is set to the NumberValue
game.ReplicatedStorage.ChangeTrail.OnServerEvent:Connect(function(plr, NumberValue, number)
if plr then
if NumberValue and number then
NumberValue.Value = number
end
end
end)
New module code
local Tba = {}
function Tba:GetTrailColorLol(plr, NumberValue, number) -- number is uhhh idk
if plr then
if NumberValue and number then
NumberValue.Value = number
script.Parent.ChangeTrail:FireServer(plr, NumberValue, number) -- script.Parent is Replicated Storage
return NumberValue
end
end
end
return Tba
game.ReplicatedStorage.ChangeTrail.OnServerEvent:Connect(function(plr, NumberValue, number)
if plr then
if NumberValue and number then
NumberValue.Value = number
return NumberValue
end
end
end)
and it gives me this annoying error again
21:00:18.650 - Value is not a valid member of Player
21:00:18.654 - Stack Begin
21:00:18.656 - Script 'ServerScriptService.Receive', Line 4
21:00:18.658 - Stack End