So I've tried to do this but it seems it will work inside Studio but not inside the actual game, so it must be something to do with FE, so could someone please help me make it work with FE?
Client Side:
local codes = script.Parent.Parent.Codes -- location of the codes
local ds = game:GetService("DataStoreService")
local store = ds:GetDataStore("CodeSave")
script.Parent.MouseButton1Down:Connect(function()
if script.Parent.Parent.codeBox.Text == "Alpha" then
if codes.Alpha.Value == true then
script.Parent.Parent.codeBox.Text = "Already Redeemed!"
end
if codes.Alpha.Value == false then
codes.Alpha.Value = true
game.ReplicatedStorage.GiveMoney:FireServer()
script.Parent.Parent.codeBox.Text = "Redeemed!"
end
end
end)
Server Side:
game.ReplicatedStorage.GiveMoney.OnServerEvent:connect(function()
local codes = game.StarterGui.CodeSystem.RedeemArea.Codes
game.Players.LocalPlayer.leaderstats.Credits.Value =
game.Players.LocalPlayer.leaderstats.Credits.Value + codes.Alpha.Reward.Value
end)

3 comments
You are accessing LocalPlayer from a serverscript?
what would I use instead?
Lol see below VV