Price not changing

I want you to try it to check if you can send data to client with ease

Okay… what do I put for the parameters in the local script?

you don’t, place the OnServerEvent in the server script. Ngl u are giving very limited information abt ur script

Sorry, I meant in the OnClientEvent function, what would I put in the parameters of the function?

--localscript
BuyTimeEvent.OnClientEvent:Connect(function(--what do i put here)

print(TimePrice)

print(cornStat)

end)

This is what u need to put. What I posted before

I did do that already, but it doesn’t work

Wait i think I mistyped smth, place the :FireClient() in server script and in ur local script place the :OnClientEvent

That’s what I did already, though

alr man I don’t how to fix ur problem. If you send the game file for the shop system. I can properly diagnose it and send an explanation of how to fix it.

alright fine, how do i save it as a file though?

File > Save File in roblox studio

Screen Shot 2022-05-28 at 8.36.46 PM
Where is that? I don’t see it

First save it to roblox, then go to files and click “download a copy”

0chi.rbxl (79.5 KB)

Nevermind, i updated my script and it works now! I guess it was a bug or something

New Script
--Script
local RepStorage = game:GetService("ReplicatedStorage")
local SStorage = game:GetService("ServerStorage")
local StarterGui = game:GetService("StarterGui")
local SoundService = game:GetService("SoundService")

local TimePrice = SStorage:WaitForChild("TimePrice")
local TimePriceLabel = StarterGui.BuyTime:WaitForChild("TimePriceLabel")
local BuyTimeEvent = RepStorage:WaitForChild("BuyTimeEvent")
local module = require(RepStorage:WaitForChild("ModuleScript"))
local sound = SoundService:WaitForChild("vine boom sfx")

BuyTimeEvent.OnServerEvent:Connect(function(player)
	local leaderstats = player.leaderstats
	local cornStat = leaderstats:WaitForChild("corn")
	local timeupgStat = leaderstats:WaitForChild("timeupg")
	if cornStat.Value >= TimePrice.Value then
		cornStat.Value = cornStat.Value - TimePrice.Value
		TimePrice.Value = TimePrice.Value + TimePrice.Value * 0.1
		timeupgStat.Value = timeupgStat.Value + 1
		module.waitTime = (module.waitTime * 0.1 - module.waitTime) * -1
		print(module.waitTime)
		BuyTimeEvent:FireClient(player,TimePrice.Value,cornStat.Value)
	else
		print("broke")
		sound:Play()
	end
end)
--LocalScript
local RepStorage = game:GetService("ReplicatedStorage")
local BuyTimeEvent = RepStorage:WaitForChild("BuyTimeEvent")
local PlayerGui = game:GetService("Players").LocalPlayer.PlayerGui
local TimePriceLabel = PlayerGui.BuyTime:WaitForChild("TimePriceLabel")
local cornGui = PlayerGui.cornamount.Frame:WaitForChild("cornamountlabel")
script.Parent.MouseButton1Click:Connect(function()
	BuyTimeEvent:FireServer()
end)
BuyTimeEvent.OnClientEvent:Connect(function(TimePrice,cornStat)
	print(TimePrice)
	print(cornStat)
	TimePriceLabel.Text = tostring(TimePrice).." Corn"
	cornGui.Text = tostring(cornStat)
end)
2 Likes