Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to change a StringValue in ReplicatedStorage from a LocalScript?

I've made a KillFeed and now I am having trouble setting the StringValue in ReplicatedStorage to nothing from my LocalScript so that if player1 kills player2 twice in a row it will show up twice

What I have tried to add

game.ReplicatedStorage.Killer.Value = ""

My LocalScript is inside a frame and the frame is inside a ScreenGui

local RSKiller = game:GetService("ReplicatedStorage"):WaitForChild("Killer")
local RSVictim = game:GetService("ReplicatedStorage"):WaitForChild("Victim")

script.Parent.killer.Text = ""
script.Parent.victim.Text = ""
script.Parent.Sword.Image = ""

RSKiller:GetPropertyChangedSignal("Value"):Connect(function()
	
	script.Parent.killer.Text = RSKiller.Value
	script.Parent.Sword.Image = "rbxassetid://2763211080"
	wait(3)
	script.Parent.killer.Text = ""
	game.ReplicatedStorage.Killer.Value = ""
				
end)

1 answer

✓ Accepted answer

Although the client can access and modify ReplicatedStorage, these changes will not replicate to the server or other clients.

Make sure that you're not looking on the server side when you check to see if the value changes.

Additionally, you're modifying the value whenever the value's changed, it's going to loop itself at line 14.

6 comments

0

I was looking for the change on the server side and I just looked on the client side and it does change back to nothing but if I kill player2 again it doesn't change it just stays blank

0

Did you try manually changing the value? You might desync it from the server by changing it locally, and it stays what you set it local. I've never really messed with client/server interactions, so that might be something to test.

0

Ok, I tried manually changing it on both, and if I change it on client nothing happens if I kill player2 again, but if I change it on the server side and then kill player2 it works and how do I fix the loop issue?

0

After line 8 put if RSKiller.Value == "" then return end

0

I think they are desynced like you said if I kill player2 everything works on the client side, but on the server side the StringValue stays as "Player1"

0

I got it working thank you!

This discussion is preserved as it was. New answers, comments, and votes are closed.