So I just want to know where to put the Fast Cast module because when you parent it into StarterGui or inside a tool, the cast would stop and would just stay in place when the player resets or leaves. So any way to fix this?
FastCast module:
So I just want to know where to put the Fast Cast module because when you parent it into StarterGui or inside a tool, the cast would stop and would just stay in place when the player resets or leaves. So any way to fix this?
FastCast module:
The most recommended way is to put the Module in ServerStorage, however, if you want to ask a very specific question about the Module, I recommend asking it in the post itself.
This for errors of the Module and not errors on your code, if it is in your code, you can create a topic asking.
I know a good tutorial on how to use this Module correctly.
I recommend you learn to program first and not just copy if you are going to watch the video.
Well, what about the client script? My FastCast module is in ServerStorage but where should I put the FastCast handler?
I have tried putting the client handler in the tool and PlayerGui but it stops working if you unequip or reset.
This does not exist, if it does, it was/is a Script that was inside the Module in its hierarchy.
Take the Module Model again and just put “FastCast” in ServerStorage, do not remove or edit anything inside it.
(I do not need to info about deleting the old FastCast model and etc before taking a new model, right?)
Sorry, I mean’t this client code:
local FastCast = require(Modules:WaitForChild("FastCastRedux"))
local caster = FastCast.new()
local Projectiles = workspace:WaitForChild("Projectiles")
local DataModule = require(script.Parent:WaitForChild("DataModule"))
local castParams = RaycastParams.new()
castParams.FilterType = Enum.RaycastFilterType.Exclude
castParams.FilterDescendantsInstances = {Projectiles, character}
local castBehavior = FastCast.newBehavior()
castBehavior.RaycastParams = castParams
castBehavior.Acceleration = DataModule.EffectGravity
castBehavior.AutoIgnoreContainer = false
castBehavior.CosmeticBulletContainer = Projectiles
castBehavior.CosmeticBulletTemplate = DataModule.Projectile
castBehavior.MaxDistance = DataModule.ProjectileMaxDistance
FastCast.VisualizeCasts = DataModule.DebugMode
caster.LengthChanged:Connect(function(cast, lastPoint, direction, length, velocity, projectile)
if projectile and projectile.PrimaryPart ~= nil then
local projectileLength = (projectile.PrimaryPart.Size.Z/2)
local offset = CFrame.new(0, 0, -(length - projectileLength))
projectile:PivotTo(CFrame.lookAt(lastPoint, lastPoint + direction):ToWorldSpace(offset))
end
end)
caster.RayHit:Connect(function(cast, result, velocity, projectile)
local hit = result.Instance
end)
caster.CastTerminating:Connect(function(cast)
local cosmeticBullet = cast.RayInfo.CosmeticBulletObject
if cosmeticBullet ~= nil then
cosmeticBullet:Destroy()
end
end)
script.Parent.Fire.OnClientEvent:Connect(function(startPos, mouseHit)
local direction = (mouseHit - startPos).Unit
caster:Fire(startPos, direction, DataModule.ProjectileSpeed, castBehavior)
end)
Where should I put this client code?
You made it or you just copied it? If you copied it, i information you to do not do that;
If it was you who did it… I recommend re-think about issues of Raycasting on the Client, as it will not cause damage on others players (just on your client) and will make the Script fragile.
But, now, answering your main question… put it inside the Tool that would be the weapon or something like that.