I’m a rookie at scripting, and I’m trying to make it so that when the event is triggered, it adds 1 to the value and changes the text to the value, but for some reason, the text and value remain the same.
local triggerPart = script.Parent
local events = game.ReplicatedStorage.Events
local event = events.Smoked
triggerPart.Touched:Connect(function(hit)
if hit.Parent.Name == "elg" or hit.Parent.Name == "elk" then
event:FireAllClients("smoked")
hit:Destroy()
print("smoked meat")
end
end)
and
local events = game.ReplicatedStorage.Events
local event = events.Smoked
local value = script.Parent.count
local text = script.Parent.Count
event.OnClientEvent:Connect(function(action)
if action == "smoked" then
value.Value = value.Value + 1
text.Text = tostring(value.Value)
end
end)
LocalScripts, with the exception of being inside of a player’s character, cannot run in Workspace. Your SurfaceGui must be moved to StarterGui, and its Adornee set to Counter.Count to continue rendering as it was before