How i make a super power? Like throwing a plasma ball with some effects on it that moves and when it touches anything that deletes and add sparkles?


Like that blue ball is the plasma and these yellow blocks are the moving effects.
if anyone can teach me or send the script i’ll be thankful.
Thanks for reading! :smiley:

3 Likes

I don’t know nothing about tools, and how to script them, but you can insert some lines delete stuff when the plasma ball touches something, first of all, lets imagine that when you click, a block is created (You must edit it to make something like a fireball) and add this script in the tool

PlasmaBall.Touched:Connect(function(hit)
    --Explosion effect
    hit:Destroy()
    PlasmaBall:Destroy()
end)

ok this is a vague reply, but i can’t help you more since i’m not very good at scripting and because this category is to help on a script (Like issues, bugs, stuff to optimize, etc.) and not to ask the entire script. Well, good luck!

4 Likes

I could think about plenty of ways to do this, but its all about preference. This category isn’t for entire scripts made just for you, but, we can still help you with a script. In a script, once you have a reference of your plasma ball model inside, you could move it without any rotation by using Model:TranslateBy(direction). If we translate it by our lookvector every 0.03 seconds, we can get a smooth movement going on. NOTICE! Please set the models primary part first!! You can set it to the plasma ball it self, also make sure to weld everything.

There is a way to get rotation AND movement, thats by using Model:GetPrimaryPartCFrame(),
and using Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame() * cframeHere).
Anyways yea, there’s a couple of ways to do this, you could use body movers for physics. I personally dont use body movers but you can use whatever you like.

EDIT:
I forgot to mention that .Touched will most likely NOT work here, even then you shouldn’t use .Touched for slightly advanced scripts like this. It’s okay for a killbrick or something but yea. Refer to @mishajones guide below me in order to make it a tool!

4 Likes

A good way to make a tool work is by placing a Script and a LocalScript in it. To make your tool FilteringEnabled-compatible, you will need a RemoteEvent (ideally a descendant of the tool).

LocalScript: stuff coming from the player.

--reference to the RemoteEvent, here "event"
local Tool = script.Parent -- assuming the script is directly parented to the tool
Tool.Activated:Connect(function() -- this is fired when you click
	event:FireServer()
end)

Script: what you want to take place in the server.

event.OnServerEvent:Connect(function()
	--stuff, e.g.:
	local sparkles = Instance.new("Sparkles", script.Parent.Handle)
end)

Inside this script, you can include @momoxjiro’s suggestions. Also, you can use Raycasting to determine the position the orb will travel to (instead of Touched function, which might have weird effects in this case).

4 Likes

Firstly, you need to choose a way to move your projectile and create your animations. I would recommend setting CFrames per part on Heartbeat, however it’s perfectly acceptable to use body movers or even better, constraints such as a LineForce.

Next you’ll want to determine how you will do hit detection. There are plenty of ways to do this with varying levels of ease/consistency.

Touch events are by far the simplest and most common but require physics interactions to occur (meaning CFrame can be used but requires the projectile to be unanchored and its velocity must be reset on Heartbeat).

Ray casting is most likely the next easiest choice (and additionally the next most common one) and may be more reliable however the detection will be less accurate. It’s more performant than the next method but less performant that Touch events however it is extremely reliable.

And the final method I can think of, GetTouchingParts. This would have the worst performance (the more triangles in your projectile, the worse performance) but is sort of best of both worlds in terms of accuracy and reliability. It should be both visually accurate (each triangle in your model is simulated) and fully reliable if used on Heartbeat (all physics updates will occur immediately before Heartbeat so every interaction is up to date).

When you detect a hit you can do just about anything you want such as creating particles and similar effects.

Finally, you should make sure the projectile is shot from the server and movement/detection happens on the server. The client just needs to tell the server “hey I’m going to shoot now” and the server should decide if they are allowed to shoot and if so, shoot the projectile. If you want to improve responsiveness on the client who shot, you can additionally “mimick” the server and shoot a fake projectile on the client immediately and sync it with the server projectile however this is optional.

4 Likes

4 posts were merged out. Please use the like button instead of individually thanking users.