ProximityPrompt Retrieves Default Tool Values Instead of Updated Ones

Not sure if this is the exact problem going on here so I’m assuming, but I’m having trouble with my script not retrieving the updated values (of a StringValue, BoolValue, and IntValue) of a tool.

I have a “Bucket” tool stored in StarterPack, and the child values (Filled, LiquidType, Uses) that get updated when the player fills the bucket with water, etc. And I have a ProximityPrompt assigned to a part that should print the current updated values of the Bucket tool, but keeps showing the default values instead.

local placeholder = script.Parent
local pp = placeholder:WaitForChild("ProximityPrompt")

pp.Triggered:Connect(function(plr)
	local backpack = plr:FindFirstChild("Backpack")
	local char = plr.Character or plr.CharacterAdded:Wait()
	
	local bucket = nil
	
	if backpack then
		bucket = backpack:FindFirstChild("Bucket")
	end
	
	if not bucket and char then
		bucket = char:FindFirstChild("Bucket")
	end
	
	if not bucket then
		bucket = plr:FindFirstChild("Bucket")
	end
	
	if bucket then
		print("Parent: ", bucket.Parent)
		
		local filled = bucket:FindFirstChild("Filled")
		local liquidType = bucket:FindFirstChild("LiquidType")
		local uses = bucket:FindFirstChild("Uses")
		
		if filled and liquidType and uses then
			print("Filled:", filled.Value)
			print("LiquidType:", liquidType.Value)
			print("Uses:", uses.Value)
		end
	end
end)

And in the Output, after getting water, it shows:

  21:47:47.444  bucket has water  -  Client - LocalScript:27
  21:47:49.477  Parent:  ADreadful_Reality  -  Server - Script:23
  21:47:49.479  Filled: false  -  Server - Script:30
  21:47:49.479  LiquidType:   -  Server - Script:31
  21:47:49.479  Uses: 3  -  Server - Script:32

The values should show “Filled: true”, “LiquidType: water”, and “Uses: 3” (didn’t script this one yet), but they keep displaying the default values instead.

Also while testing the game, under the player and their backpack, the tool’s values are updated to what they are supposed to be.

Are the child values updated on the server or client?

It also seems that the tool is a child of your player object? That is odd.

Client side I believe (random text so I can go across the minimum text)

Oh, is that not right? It prints “Parent: Backpack” when the tool isn’t equipped. Idk if that helps.

That’s the issue. The code that detects the proximity prompt is on the server, so any changes you make on the client are not replicated to the server.

Also, ignore my previous comment about the tool being a child of the player–it is actually a parent of the character when those print messages came out.

1 Like

the ProximityPrompt code you showed is on the server but you are updating the values only on the client

1 Like

Ohh okay, I see now. I’ll use a RemoteEvent or something. Thanks sm for the help.

Thanks, I can’t mark two responses as solutions but I appreciate the help

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.