Hi I am new to this platform.
I am having an issue with .Touched
events. Specifically reading an IntValue
.
The script is server-side and is in game.Workspace.sell_shop.Sell.Part
and the script gets player data from the players leaderstats (Clicks, Money and Rebirths).
This is the current code I have so far:
local part = script.Parent local players = game:GetService("Players") part.Touched:Connect(function(otherPart) if otherPart.Parent:FindFirstChild("Humanoid") then local player = players:GetPlayerFromCharacter(otherPart.Parent) local clicks = player.leaderstats.Clicks.Value print(clicks) -- Prints 0 end end)
Localscripts can read these leaderstats and scripts in ServerScriptService can get leaderstats
Server scripts can't access values in LocalPlayer. You can try firing RemoteEvent and make separate LocalScript in StarterGui or StarterPlayerScripts and when the RemoteEvent is fired, it prints amount of clicks.
Hope this helps!
(Edit: Server can't read values changed by local scripts)