So basically I have a script that when a remoteevent is fired it buys the object, and it works fine in studio, but I just can't seem to get it to work in-game!
error: https://gyazo.com/8fa5b2ee66feb0a44fa54a99fd96c3be
Here is the server side code (the problem code, stored in ServerScriptService):
game.ReplicatedStorage.turretControl.OnServerEvent:connect(function(Message,Cost,planet)
print"good"
planet= game.Players.LocalPlayer.PlayerGui.Main.Frame.Value.Value
local planetID=game.Workspace.Planets:FindFirstChild(planet)
local turret= game.ServerStorage.Turret
local turretm= turret:Clone()
turretm.Extra.Bought.Value=true
turretm.Parent = planetID
end)
Client side code (stored inside a Gui and pretty much just fires the remote event):
game.ReplicatedStorage.getMoney.OnServerEvent:connect(function(plr,Message,Cost,planet)
local credits=plr.leaderstats.Credits.Value
print"1"
local turret= game.ServerStorage:FindFirstChild(Message)
print"2"
credits=credits-Cost
print"3"
print(credits)
game.Players.LocalPlayer.leaderstats.Credits.Value=credits
game.ReplicatedStorage.turretControl:FireServer(Message,Cost,planet)
end)
Note: I have a leader-board stored in the ScriptService also, so I don't understand the error!

1 comment
Just a side note, including where the event is originating from most definitely helps, as I didn't realize but should have that the problem was the fact that he was using a RemoteEvent to fire a event from a client to the same client, the entire purpose of the BindableEvent. Simply something to keep in mind for future readers c: