local prox = script.Parent
prox.Triggered:Connect(function(plr)
local stats = plr:WaitForChild("leaderstats")
local fuel = stats.Fuel.Value
local orbfuel = game.Workspace.Orb.Orb.Fuel
orbfuel.Value = orbfuel.Value + fuel.Value
fuel.Value = 0
end)
(no its not a local script cause i don’t think i need one for one player to lose money when they press E on the part)
the error: Workspace.Press E.ProximityPrompt.Script:9: attempt to index number with ‘Value’
a bit more of explanation:
so orb is what needs to be fueled up to level up to the next level, so the player needs to collect the small orbs to collect the fuel, when the player has fuel they can go up to the orb and Press and Hold E for 2 seconds and however much fuel they have will add the number of the fuel to the orbs fuel and also puting the collected fuel to 0 so that player has to get more. once the orb hits 100 fuel (100/100) then the orb will level up and need double the fuel.
local prox = script.Parent
local player = game:GetService("Players").LocalPlayer or game.Players.LocalPlayer --Best way to avoid hacks
prox.Triggered:Connect(function(plr)
local user = player --get player from touching human
wait(0.5)
local stats = user.leaderstats
local fuel = stats.Fuel.Value
local orbfuel = game.Workspace.Orb.Orb.Fuel
orbfuel.Value = orbfuel.Value + fuel.Value
fuel.Value = 0
end)
You can’t define the player like that if it’s on a server script, remove the player variable & reference the plr parameter provided in the ProximityPrompt.Triggered event instead
local prox = script.Parent
prox.Triggered:Connect(function(plr)
local stats = plr:WaitForChild("leaderstats")
local fuel = stats.Fuel.Value
local orbfuel = game.Workspace.Orb.Orb.Fuel
orbfuel.Value = orbfuel.Value + fuel.Value
fuel.Value = 0
end)
yea but the orbfuel is for the orb that the player needs to level up when that orb has enough fuel it levels up, But the fuel is the little orbs that give the player the fuel so the player can level the orb up.
good news and bad news… good news it works by putting the fuel from player to 0. Bad news is the number on the orb didn’t go up…
the orbs script:
local health = script.Parent.Fuel.Value
local orb = script.Parent
health.Changed:Connect(function()
script.Parent.BillboardGui.TextLabel.Text = "Fuel"..health.Value.."/100"
end)
if health == 100 then
orb.BrickColor = BrickColor.new*("Neon orange")
end