I’m thinking if there is any way to manipulate a localscript using variables in a normal script. I’m not sure if you are supposed to use getfenv but I’m interested if there are any other ways of getting it to work without values.
Realistically, not in the sense that you want.
Everything that happens on a script actually runs on a completely different machine to where LocalScripts run.
There are ways to share values between them, and I’d advise using RemoteEvents here
Server Script
ReplicatedStorage.SendData:FireAllClients{Coins = 100}
LocalScript
ReplicatedStorage.SendData.OnClientEvent:Connect(function(newData)
print("got data!", newData)
end)
If you’re trying to maintain consistent state between the server and client. Dont. Its performance intensive. Just ask the server for stuff when it’s needed
getfenv().myvar = var
It’s very dangerous tho as exploiters CAn use it
module scripts could work too, as unlimited said.