Question: local replicatedStorage = game:GetService ( ReplicatedStorage ) - - Find the RemoteEvent instead of waiting for it local remoteEvent = replicatedStorage:FindFirstChild (

local replicatedStorage = game:GetService("ReplicatedStorage")
-- Find the RemoteEvent instead of waiting for it
local remoteEvent = replicatedStorage:FindFirstChild("ShootProjectileEvent")
if not remoteEvent then
error("ShootProjectileEvent not found in ReplicatedStorage.")
return
end
local function onShootProjectile(player, direction, origin)
local projectile = replicatedStorage:FindFirstChild("Blast-Wizard")
if not projectile then
error("Blast-Wizard projectile not found in ReplicatedStorage.")
return
end
local newProjectile = projectile:Clone()
newProjectile.Parent = game.Workspace
newProjectile.Position = origin
-- Server-side logic for projectile behavior
local function onTouched(hit)
local hitHumanoid = hit.Parent:FindFirstChildOfClass("Humanoid")
if hitHumanoid and hit.Parent ~= player.Character then
hitHumanoid:TakeDamage(10)-- Adjust the damage as needed
newProjectile:Destroy()
elseif hit.Parent:IsA("Terrain") then
newProjectile:Destroy()
end
end
newProjectile.Touched:Connect(onTouched)
wait(3)
newProjectile:Destroy()
end
remoteEvent.OnServerEvent:Connect(onShootProjectile)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!