Remote Event Script
local function buyworlds(player, name, amount) local stats = player.leaderstats if stats.Coins.Value > tonumber(amount) or tonumber(amount) then game.Workspace.Worlds[name].AreasBlock.Sides2:Destroy() stats.Coins.Value = stats.Coins.Value - amount message["Main.World.Buy.Enough"].Visible = true else message["Main.World.Buy.NotEnough"].Visible = true end end buyworld.OnServerEvent:Connect(buyworlds)
LocalScript that fires the event
while wait() do local worldName = script.Parent.WorldName.Value local buyValue = script.Parent.BuyValue.Value local plr = game:GetService("Players").LocalPlayer game:GetService("ReplicatedStorage").buyWorld:FireServer(plr, worldName, buyValue) end
Script that shows up the frame
local message = game:GetService("StarterGui").Message["Main.World.Buy"] function onTouch(part) message.BuyValue.Value = 1000 message.WorldName.Value = script.Parent.Parent.Parent.Name message.Visible = true end script.Parent.Touched:connect(onTouch)
Please help!
When you do fireserver, don’t fire it with the player, it’s automatically added. Shouldn’t have the error anymore once plr is removed
hey you! have you ever heard of enes? if you are in trouble, better call enes!