Hi so basically I am creating a spell system where it sends a request to the remote function and then the remote function does the spell? Basically as I do not want to use remote events to test out some new things.
Basically the systems sends a request to the function and then the function does the server-side scripting of the “power” and then it’ll work basically - Having some issues with this please let me know -
Current code:
Client:
function Module.TelekineticPush()
local Mouse = Player:GetMouse()
if Mouse.Target.Parent:FindFirstChild('UpperTorso') then
if (Player.Character.HumanoidRootPart.Position - Mouse.Hit.Position).Magnitude < 25 then
game.ReplicatedStorage:WaitForChild('Remotes'):WaitForChild('Quickcast'):InvokeServer('TkPush',Mouse.Target.Parent)
print('Succesfully worked.')
end
end
end
UIS.InputBegan:Connect(function(key, eve)
if eve then return end
if key.KeyCode == Enum.KeyCode.E then
Module.TelekineticPush()
end
end)
Server
--// Services
local ReplicatedStorage = game:GetService('ReplicatedStorage')
local Players = game:GetService('Players')
--// Items
--# Remotes
local AbilitiesFunction = ReplicatedStorage:WaitForChild('Remotes'):WaitForChild('Abilities')
local CharacterSelectFunction = ReplicatedStorage:WaitForChild('Remotes'):WaitForChild('CharacterSelect')
local ProjectileFunction = ReplicatedStorage:WaitForChild('Remotes'):WaitForChild('Projectile')
local QuickCastFunction = ReplicatedStorage:WaitForChild('Remotes'):WaitForChild('Quickcast')
local Rituals = ReplicatedStorage:WaitForChild('Remotes'):WaitForChild('Rituals')
--# Objects
--# Variables
local Spells = require(ReplicatedStorage:WaitForChild('Modules'):WaitForChild('Spells'))
local QuickCast = require(ReplicatedStorage:WaitForChild('Modules'):WaitForChild('Spells'):WaitForChild('QuickCast'))
local Abilities = require(ReplicatedStorage:WaitForChild('Modules'):WaitForChild('Spells'):WaitForChild('Abilities'))
--# Misc
--// Scripts
-- # Listeners
QuickCast.OnServerInvoke = function(Player,Spell,Target)
if Spell and Player and Target then
if Spell == "TkPush" then
local LoadAnim = Player.Character.Humanoid:LoadAnimation(game.ReplicatedStorage.Storage.Animations.TKPush)
LoadAnim:Play()
local UpperTorso = Target:WaitForChild('UpperTorso')
local Humanoid = Target:WaitForChild('Humanoid')
local BV = Instance.new ("BodyVelocity",UpperTorso)
BV.MaxForce= Vector3.new(math.huge,math.huge,math.huge)
BV.Velocity= Player.Character.UpperTorso.CFrame.lookVector* 75
Humanoid:TakeDamage(25)
wait(0.2)
BV:Destroy()
Target:WaitForChild('RagdollR15').Activate.Value = true
wait(3)
Target:WaitForChild('RagdollR15').Activate.Value = false
print("found")
end
end
end