Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How can I make it so that when I fire my spell, the player's character doesn't move as well?

local TS = game:GetService("TweenService")
local Info = TweenInfo.new(
	1.5,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.In,
	0,
	false,
	0	
)

local infoTwo = TweenInfo.new( 
	1.3,
	Enum.EasingStyle.Sine,
	Enum.EasingDirection.In,
	0,
	false,
	0
)






local goals = {
	Size = Vector3.new(35,2,2);
	Transparency = 1;
	
}



local goalsTwo = {
	Transparency = 1;
}





local RS = game:GetService("ReplicatedStorage")
RS.MouseCords.OnServerEvent:Connect(function(player,mousePos,humanoid)
	local part = Instance.new("Part",workspace)
	local MagicTween = TS:Create(part, Info, goals)
	humanoid.WalkSpeed = 30
	part.Shape = Enum.PartType.Cylinder
	part.Material = Enum.Material.Neon
	part.BrickColor = BrickColor.new("Lily white")
	part.Anchored = true
	part.CanCollide = false
	part.Size = Vector3.new(40,10,6)
	part.CFrame = CFrame.new(mousePos) * CFrame.Angles(0,0,math.rad(90))
	MagicTween:Play()
	
	local wave = game.ServerStorage:WaitForChild("Wave"):Clone()
	local WaveTween = TS:Create(wave, infoTwo, goalsTwo)
	wave.Parent = workspace
	wave.CanCollide = false
	wave.CFrame = part.CFrame * CFrame.Angles(0,0,math.rad(-90)) 
	WaveTween:Play()
	
	game.workspace.Sound:Play()
	game.Workspace.Laser:Play()
	

	
	
	wait(2)
	wave:Destroy()
	part:Destroy()
	wait(0.5)
	game.workspace.Sound:Stop()
	humanoid.WalkSpeed = 16
	
end)

This is my script that fires when a my remote event is triggered in a separate local script. I know the local script part works, and that is why I haven't included it here. So my problem: Whenever I use my spell with my tool, my character's CFrame changes. Im completely clueless on why this happens and I really want to know how I can make the fix. Everything else works fine but I need some way to keep the character's position the same. Also, (player,mousePos,humanoid) are passed from my remote event trigger. Thanks

5 comments

0

Is the CFrame of the player changing, or is the player just simply being pushed? It's really hard to help when we don't really have much to go on. I'd like to see the rest of the code,or a place file, so I can test and debug it. At the very least a video/gif of it firing. Im kind of thinking the fireball is pushing the player away, but I can't be sure without further research

0

I will public the game and put the link here. Just use the tool, and click to fire the spell. Thanks! https://www.roblox.com/games/6127888398/Untitled-Game?refPageId=08147c95-d544-4ff0-8b5c-f901ed3ba04b

0

Yes I think it is pushing the player away, how can I solve that?

0

Sorry the late reply. I looked at your place and I have no clue whats happening. The further away you click the further you get tped. Are you sure your teleport and spell scripts aren't affected by eachother? It seems like its shooting the fireball, and using the teleport tool at the same time.

0

I dont think my teleport script is affecting my spell as this problem was occurring before I even made the spell. The fireball was also made after. Im honestly really confused about why its happening, my code looks fine right?

1 answer

45 humanoid.WalkSpeed = 30

try changing that. i dont know what else to change

1 comment

0

change it to 0

This discussion is preserved as it was. New answers, comments, and votes are closed.