-
What do i want to achieve?
I want to be able to fire the remoteEvent to the server using the GetMarkerReachedSignal function to create a part. -
What is the issue?
robloxapp-20240216-1209066 -
What solutions have i tried so far?
I tried to add as task.wait to see if it is having some problems firing. -
Code
Client
local UserInputService = game:GetService("UserInputService")
local Players = game:GetService("Players")
local ClientPlayer = Players.LocalPlayer
local Character = ClientPlayer.Character or ClientPlayer.CharacterAdded:Wait()
local Humanoid = Character.Humanoid:: Humanoid
local Anim = script.Animation
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
UserInputService.InputBegan:Connect(function(input, gpe)
if gpe then
return
end
if input.KeyCode == Enum.KeyCode.Q then
local Animator = Humanoid:FindFirstChildOfClass("Animator")
local LoadAnim = Animator:LoadAnimation(Anim)
LoadAnim:Play()
print("You pressed Q")
LoadAnim:GetMarkerReachedSignal("Summon"):Connect(function(parameter)
task.wait(3)
RemoteEvent:FireServer("testsummon")
end)
end
end)
Server
local TweenService = game:GetService("TweenService")
local RemoteEvent = game.ReplicatedStorage.RemoteEvent
RemoteEvent.OnServerEvent:Connect(function(player, eventtype)
if eventtype == "testsummon" then
local Domain = game.ServerStorage.Part:Clone()
Domain.Parent = workspace
Domain.CFrame = player.Character.HumanoidRootPart.CFrame * CFrame.new(0, -3, 0)
Domain.Orientation = Vector3.new(0, 0, 90)
local tweenInf = TweenInfo.new(1, Enum.EasingStyle.Exponential, Enum.EasingDirection.Out)
local tween = TweenService:Create(Domain, tweenInf, {Size = Vector3.new(15,15,15)})
tween:Play()
tween.Completed:Connect(function()
Domain:Destroy()
end)
end
end)
It plays the anim but does not summon the part why?(This is my first help forum sorry if i did something wrong)