I am trying to make a snow plowing job in my game, and when you plow a part off, you get a SnowPoint in the leaderstats. I am a scripter who learns on very little, and because of that, I need some help. I took a vehicle from workspace and welded a part on the vehicle, named "PLOW PART" . This part is the part that 'plows' the snow. There is another part called "Snow", which is the part that is plowed. Here is the working script for the plow part when I didn't add the SnowPoint for them (The snow part does not have a script) :
PLOW PART script:
function onTouch(hit) if hit.Name == "Snow" then hit.Transparency = 1 wait(10) hit.Transparency = 0 end end script.Parent.Touched:connect(onTouch)
The script 'plows' the things named "Snow". Though, with the edited version that is supposed to give you the SnowPoint just does not give the SnowPoint and doesn't make the "PLOW PART" even 'plow' the snow. I put in "--added" so you can figure out what was edited from the original.
PLOW PART script:
local user = game.Players--added local stats = user:findFirstChild("leaderstats")--added local SnowPoint = stats:findFirstChild("SnowPoint")--added function onTouch(hit) if hit.Name == "Snow" then hit.Transparency = 1 wait(10) hit.Transparency = 0 SnowPoint.Value = SnowPoint.Value +10--added end end script.Parent.Touched:connect(onTouch)
And here, so you don't have to do any more scripting, is the leaderstats that i set up, the "PLOW PART", and vehicle:
NOT WORKING PLOWER (edited one) : https://www.roblox.com/library/4484861101/Not-working-Plower
WORKING PLOWER (original): https://www.roblox.com/library/4484936565/Original-snow-plower
I know i was a bit confusing, so please feel free to ask any questions, and thanks!
Now tell me exactly where this script is but from looking at the script I think I know where so try this:
local user = script.Parent.Parent.Parent.Parent -- First Parent Plow Part, Second Tool, Third Backpack, and Finally Player local stats = user:FindFirstChild("leaderstats")--added local SnowPoint = stats:FindFirstChild("SnowPoint")--added function onTouch(hit) if hit.Name == "Snow" then hit.Transparency = 1 wait(10) hit.Transparency = 0 SnowPoint.Value = SnowPoint.Value +10--added end end script.Parent.Touched:connect(onTouch)