Local Script won't change StringValue

  1. What do you want to achieve? I am making an Item pickup script and short-story long I want to make it so that when a player picksup the item, a StringValue will change in workspace only for the one who pick it up (Client Side)

  2. What is the issue? As I don’t want the value to be changed Serverwide, I put the code that I needed in a local script, only changing the value and letting the other part to the Server-Side Script. The only problem is that it doesnt change. The output doesnt give any error

  3. What solutions have you tried so far? I tried using RemoteEvents but it still had the same outcome.

  1. This should be in #help-and-feedback:scripting-support , so please shift your post under that category.
  2. Please provide us with the relevant scripts that you already have so we’re able to assist you!

Where is the localscript Parented?

(i assume ur using that)

	if game.Workspace.Values.HasBucket.Value == "True" then 

	if not Player.Backpack:FindFirstChild("Shovel") then 
    workspace.Values.HasBucket.Value = "True"


This is the code of the Local Script. The Server Side script is the same just with the if statements being complete and withouth the workspace.Values thing so I think it isnt caused by it

It is parented under a ProximityPrompt.

They said its a StringValue :|||

Is it in the Workspace, perhaps?

1 Like

Localscripts dont work in workspace

So as I know you should put Client Side scripts in a place like StarterGui or something so it knows the localplayer and the whole client.

TL;DR: try parenting it inside StarterGui

1 Like

Pretty sure proximity prompts only work with scripts,

Try putting this code in to a normal Script and see if that works, as Local Scripts do not work in game.workspace.

@DoorsPro_Bacon @neviquatro So I tried both of what you said and I changed to a RemoteEvent and it still doesnt want to change the StringValue. I tried placing it into a Frame in the StarterGUI, moved the StringValue from Workspace to ReplicatedStorage but it still doesnt work.

If I edit the value from a Server Sided script it works perfectly but the catch is it is serverwide and I don’t want that value to be edited the same for everyone, I need it to be edited clientside so that it only changes for that specific person

You could try doing something like this:

Server script which when the proximity prompt is triggered, sends a :FireClient() function to a RemoteEvent.

Then, in StarterPlayerScripts, you could create a Local Script which when the remote event is fired, then changes the string value.

What?? Just put a LocalScript somewhere, maybe inside of StarterPlayerScripts, and do something like this:

1 Like

Ah, I hadn’t thought of that. My bad

And what is this? Why are you setting a string value to “True”? Just use a BoolValue.

@Greenloop_36 @XSiggeManx Tried both of your options, and I use a StringValue because I want to add other values. But I get to think that the problem here might be that the server is only reading changes from the Server itself and that the local script doesnt gives an output to the server, thus it not changing. So I tried FireServer but still didnt work so if you or someone can help me

You don’t want it to be client sided only?

I want it to change only for the player who triggers the prompt but still to be recognized by the server so that the other script that I use for this String recognizes it as it changed