Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make a script so when you have touched part it will change the leaderboard and next time not?

Asked by 10 years ago

Why won't it work?

if Score > LastTimesAmount == true then
Part.dontScoreAnymoreForPart = true
else
Part.dontScoreAnymoreForPart = false
end

I don't have time to test it so i don't know if it will work or not but i think it won't.

1 answer

Log in to vote
0
Answered by 10 years ago

Not entirely sure how you have 13 points but anyways. [EDIT: forgot you got points for good questions, my bad]

I will comment out your code telling you what you are doing wrong (not that it's going to help much).

if Score > LastTimesAmount == true then -- when you use an operator such as Score>LastTimesAmount it will return true or false, you don't need to put the ==  true at the end. 
Part.dontScoreAnymoreForPart = true -- dontScoreAnymoreForPart isn't a property of part so it essentially means nothing.
else
Part.dontScoreAnymoreForPart = false -- same as above
end

All the above is assuming you have a touched event in place.

Instead of linking you to parts of the wiki that will help you with what you are trying to achieve I think you need to start at the basics and work your way from there (am I missing something?)

http://wiki.roblox.com/index.php?title=Absolute_beginner%27s_guide_to_scripting

And here's a script that will work:

part = script.Parent -- assuming this script is in part
LastTimesAmount = 1
Score = 0
part.Touched:connect(function(partThatTouched) -- note that the event gives me the part that touched it
    if partThatTouched.Parent:FindFirstChild("Humanoid") and LastTimesAmount > Score then
        Score = 3 
        -- leaderboard stuff here
    end
end)

There are obviously much more efficient ways of doing this such as removing the brick after it has been touched.

Ad

Answer this question