Hello,
I have an FE-compatible gun script that works as is, thanks to the wonderful AlvinBloxx. But what I'd like for it to do is to change the amount of damage dealt, based on if certain BoolValues are set to true or not.
For example, what I'd love for it to be able to do is:
if player.Upgrades.HasRed.Value == true then
damage = 50
else if player.Upgrades.HasBlue.Value == true then
damage = 75
--etc.
The way the BoolValues are set is that neither can be true at once. But I realize I probably need to use a RemoteEvent for this, and I'm doing it wrong. :D I've read the Wiki, and hiimgoodpack's tutorial: https://forum.scriptinghelpers.org/topic/186/how-and-when-to-use-remoteevents-and-remotefunctions and these things are confusing.
I'm not getting any error outputs here, and the damage being dealt is not consistent.
Here's how my broken portion of the script is currently:
local serverStorage = game:GetService("ServerStorage")
local replicatedStorage = game:GetService("ReplicatedStorage").GunRemotes
local checkBoolValue = replicatedStorage:WaitForChild("CheckBoolValue")
local KOValue = "Kills"
local WOValue = "Wipeouts"
--Function to check BoolValues and establish Damage
checkBoolValue.OnServerEvent:Connect(function(player,value)
local Item1 = player.Upgrades:FindFirstChild("HasRed")
local Item2 = player.Upgrades:FindFirstChild("HasBlue"')
if Item1.Value == true then
damage = 50
elseif Item2.Value == true then
damage = 80
elseif Item1.Value and Item2.Value == false then
damage = 25
end
end)
--Rest of Gun Script below
If there's a better way to do this, with or without using RemoteEvents, I'm all for it. Thank you. :)

6 comments
I don't think this is confusing.
hiimgoodpack - Since you wrote a tutorial on it, I'm reasonably confident you don't find remote events and remote functions confusing. However, I do. :D If you see any problems with how I have it laid out, I'd appreciate your input.
hiimgoodpack is rarely helpful anymore, and you shouldn't need a remote event to check a value. If you want to change the value just have it check in a local script and change it in a server script activated by a remote event.
What? I post about security issues that you can avoid with a simple step. If security is not important to you, then I don't know what is.
Viking359 - Thanks for the response. I don't want to change the value, I want the script to check to see if the Value is true, if true, then I want the damage dealt by the weapon to be changed. :) Thats what I'm a bit thrown off on. x.x
You should print debug it do figure out what line the script messes up on, and I'd use an if statement that checks the value in a local script then if it needs to change it fire a remote event that activates a server script which changes the damage value