I have been trying to do this but it always crushes my studio
local ReplicatedStorage = game:GetService("ReplicatedStorage") local remoteEvent = ReplicatedStorage:WaitForChild("RemoteEventTest")
local function bought () local plr = game:GetService("Players") local me = game.Players.LocalPlayer print("doingfine") if me.leaderstats.Gold.Value >= 1000 then plr.leaderstats.Gold.Value = plr.leaderstats.Gold.Value - 1000 local me = game.Players.LocalPlayer local coil = game.ServerStorage.SpeedCoil coil.Parent = me.StarterPack print("executed") end end
remoteEvent.OnServerEvent:Connect(bought)