- yes its the entire script
- no its in workspace
- … you are tiring me with this… ive said already this is the only script ever
ill try and fix it later… it may be my issue, but it will prob be a while until i pinpoint the actual problem. for now, ill just leave it on hold.
The proximity prompt function gets void when you delete the proximity prompt. You either have to parent the script to proximity prompt and use script.Parent or you have to turn the trigger event into a function and recall the function for the new part
local function trigga(instance)
local main = instance.Parent
instance.Triggered:Connect(function()
local clone = main:Clone()
clone.Position = main.Position + Vector3.new(main.Size.X, 0, 0)
clone.Parent = workspace
trigga(clone.ProximityPrompt)
main = clone
instance:Destroy()
end)
end
trigga(workspace.Part.ProximityPrompt)
If that script is inside proximity prompt, then it deletes itself before even completing code.
look at my solution dont you agree it will work? this user is simply being extremely stubborn and cant accept the fact that they were wrong. They are insistent that it was a bug on Roblox’s side.
I bet it was the solution as well but they just dont want to give me
I do have 2 years of coding, but I am always very busy so im stressed out. If you are going to make a hate reply, dont do it lol. Why would I not want to give you solution?
Also, what the hell? are you that mad? why are you checking my profile?
I did not spend 2 years of coding for someone that is ignorant enough and self-centered enough to call it a lie.
I may have been wrong, but I can admit it. I was just really busy and stressed out that I didnt bother. I am sorry that I have made you angry, but please, dont do stuff like that again. Its not acceptable. It really isnt. Just because someone is stubborn, you dont go to their profile and call them out on what they call themselves.
I found the solution, and it had nothing to do with yours. my solution was simply changing the parent of the proximity prompt. MYB. Mind. Yo. Business. And. Deal. With. Not. Getting. Marked. As. Solution.
I quite literally TEACH people how to code. Its literally one of my jobs. I code C#, Lua, and Java.
Okay. let me rewrite my response in a more constructive way.
You are saying
I see you found a solution were you changed the parent of the proximity prompt. Let me explain to why this works.
In your situation there were actually 3 solutions. Before, I explained the 2 solutions you could have used but the one you found is another solution. This solution you found goes off the same logic that my 2 previous solutions had.
Here is how we can better explain why re-parenting works.
Why didn’t your previous code work?
the reason your previous code did not work is because when you deleted the proximity prompt, the .Triggered event was going on that deleted proximity prompt and not the most recently added clone. You see, a event only is looked at by the script once and it will only trigger on the thing you reference it. If you delete that reference, the trigger will never go off again. Even if there is something that isn an exact replica.
Why does your new code work?
the reason your new code works is because you are not deleting and replacing the object so the event still references the existing proximity prompt. This effectively solved the issue you were having before.
Would the solutions I provided actually work?
Yes the solutions I provided would actually work. When I first read your code I immediantly noticed that if you are trying to reclone it then the event would not work.
Lets elaborate on the solutions I provided:
-
Putting the script inside of the proximity prompt and referencing using script.parent.
this would have made it so that when you made a new clone, the script would run on being added to the game and immediantly set up a new trigger event for its parent. This method will work. -
adapting your current code to set up new trigger events for clones that are added
This solution would essentially be setting up the trigger event on the newly added parents once the previous part was deleted. This solves the issue you were having where the trigger event you had is still referencing a deleted part and would never run as it sets a new trigger event for the clone.
As you can see, its good that you found an alternative method however the statement that
is not true.
I am sorry that I said you lied about scripting for 2 years. I think its good that you are teaching people how to code the basics! There is no excuse to my behavior and I should have been more consise on why it would have worked. I still am a bit mad you didn’t even try any of the solutions I provided as it would have saved you a lot of time. Just make sure in the future to be respectful to people who are offering a solution and not to dismiss it entirely.
Thank you for your sensible reply with constructive criticism. I am sorry that I was stubborn and tired that I didnt try your ideas. I will make your previous code because I was wasting your time.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.